Possible bug:
- ElasticSearch 5.4
- Grafana v4.3.2 (commit: ed4d170)
Building a simple dashboard, utilizing Templates. Create a Type:Datasource template, then create an Type:Ad hoc filter, with $DataSource as the data source.
In Dashboard view, select Datasource, then Select various fields from Ad hoc Filter to filter by. Type ahead of Ad hoc filter shows Field Names properly.
However, the search that is sent by Grafana does not include the terms selected. In fact, it includes none of the Ad hoc data at all. As a result, the results return everything (as no terms are sent).A look at Chrome Debug shows:
– DataSource Selected
– Adhoc (configured with $DataSource) with field=message value=dwaters
Chrome Debug:
{“search_type”:“query_then_fetch”,“ignore_unavailable”:true,“index”:“indexname-"}
{“size”:0,“query”:{“bool”:{“filter”:[{“range”:{"@timestamp":{“gte”:“1497284142000”,“lte”:“1497284146000”,“format”:“epoch_millis”}}},**{“query_string”:{“analyze_wildcard”:true,“query”:"”}}**]}},“aggs”:{“1”:{“terms”:{“field”:“message”,“size”:500,“order”:{"_term":“asc”}}}}}
Creating the same Dashboard, with only the Adhoc Filter in the template (and the Datasource hardcoded), it works properly:
– Adhoc with field=message value=dwaters
Chrome Debug:
{“search_type”:“query_then_fetch”,“ignore_unavailable”:true,“index”:“indexname-"}
{“size”:500,“query”:{“bool”:{“filter”:[{“range”:{"@timestamp":{“gte”:“1497284142000”,“lte”:“1497284146000”,“format”:“epoch_millis”}}},**{“query_string”:{“analyze_wildcard”:true,“query”:"”}},{“term”:{“message”:“dwaters”}}**]}},“sort”:{"@timestamp":{“order”:“desc”,“unmapped_type”:“boolean”}},“script_fields”:{},“docvalue_fields”:["@timestamp"]}
Thanks!