Access dashboard date range in queries

I have a date range set to field -> field1
Now I need to access the same range (Only upper bound) for another field -> field2. Is it possible?
Like :-
{
"script": {
"script": "doc['field2'].value >= doc['@DashboardTimeRange_Until'].value"
}
},

Or Perhaps add a filter corresponding to Dashboard Time Range but for different field?

Hi @varundbest,

the scripted fields are evaluated on the server side and can only access data from the single document. I don't see a way to access the current timepicker value. For now you would have to manually add a date range filter on field2 and adjust its boundaries separately.

There is an ongoing effort to enable users to add input controls to dashboards. The first step was merged in https://github.com/elastic/kibana/pull/13314. There are plans to add other controls such as https://github.com/elastic/kibana/issues/14177. We are thankful for any further input you can provide in the form of feature request issues or comments.

Ability to add a filter to Dashboards with value taken from Time Range Picker would also be suffice for this functionality.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.