Populate Template variable with a query of histogram values from Elasticsearch

I want to populate a template variable dropdown from an Elasticsearch query that gives me a logarithmic range of numbers from a number field in the index.

The idea is I want to have an Execution Times dropdown that has values like 1ms, 2ms, 4ms, 8ms … etc with the minimum and maximum drive by the data in my index.

Even better is if there is a way to make the field give me a range so I can plugin the value to a query ex. executionTime:$RangeValue (would turn into [16 TO 32]) instead of what I assume I will need to to which is have two seperate dropdowns for a min value and a max value.


I don’t think you can do this. Please have a look at the Elasticsearch template variable documentation to see what’s supported.

Two seperate dropdowns for a min value and a max value is the way to go I think.

Please tell me if you’ve found any other way of solving this.


Yeah, I ended up using the two dropdowns solution.

1 Like