Comparison data between different time range

Hi Team,
I need help to achieve my cases using elasticsearch data sources. My case is i need to do comparison between 2 total counts data from 1 data source with different time range. for example, i need to do comparison of total counts between yesteday and today from the same data sources. I tried using timeranges on elastic query, but it can only be fixed date value, not dynamic (ex: now, now-1d, etc). And i read on some discussion that grafana doesn’t support query DSL of elasticsearch, which is the only solution i can think of to use range query from field timestamp.

Is there a way on grafana to achieve what i need on my case ?
my environment is
Grafana v9.0.3
Elasticsearch v7.13.4