Search code examples
elasticsearchgrafanagrafana-templating

Term aggregation using template in Grafana with Elasticsearch as data source


I have a doc in Elasticsearch with different fieldnames, eg: a,b,c,d...

I want to use templating in Grafana to query a term aggregation in such way that I get the values in a field. eg: i.

I'm trying to use this query:

{"find":"terms","field":"i","size":25}

but it does not return any values.

I know that there are some values as I query the same docs with Sense.

I have Grafana v 4.6.2 and Elasticsearch v 2.3.4


Solution

  • The field I wanted has a "-" in the string. ES sees it as a separator, this was the reason of the error.

    Changing the field's mapping to "not analyzed" should help.