Using time shift in ES|QL dashboard panels

Is time shift planned for ES|QL dashboard panels?

I'm building Kibana dashboards using ES|QL and would like to compare the time range selected in the dashboard with the same period 52 weeks earlier.

Ideally, I'd like to do something like:

FROM my-index
| WHERE
    (date >= ?_tstart AND date <= ?_tend)
    OR
    (date >= ?_tstart - 52 weeks AND date <= ?_tend - 52 weeks)

However, Kibana currently sends the dashboard time range as a top-level filter on the ES|QL request. This means documents outside the selected dashboard time range are filtered out before the ES|QL query runs, so the query cannot access the data from 52 weeks earlier.

Lens handles this nicely with:

sum(sales, shift='52w')

but I haven't found an equivalent way to do this in an ES|QL dashboard panel.

It would be very useful if an ES|QL panel could opt out of the automatic dashboard time-range filter while still receiving ?_tstart and ?_tend. The ES|QL query could then decide how to use the selected time range itself.

Is support for this kind of time shift / previous-period comparison in ES|QL dashboard panels planned?

My main use case is comparing the currently selected period with the same period 52 weeks earlier, but the same capability would also be useful for WoW, MoM and other period comparisons.

I think this might be in Streamstats in ES|QL: running statistics over time windows · Issue #111 · elastic/roadmap · GitHub
Which is in the roadmap....

Not sure what is the progress on it though. And may be it's unrelated anyway :wink: