Adhoc filter & ElasticSearch7.9 datasource not working correctly

Grafana 7.1.4, ElasticSearch7.9, Chrome Version 84.0.4147.135

Adhoc filters (ElasticSearch Datasource) are not working correctly on a Table Panel.

I have created a table panel aggregating (count)
Group By TERMS user_name Order by: Term value (desc)
Then By TERMS group_name Order by: Term value (desc)
Then By TERMS job_status Order by: Term value (desc)

using an Elastic DS and an adhoc filter using the same Elastic DS for the adhoc filter.

Selecting to positively filter on one of the fields yields no data resulting in the following error.
{
“request”: {
“url”: “api/datasources/proxy/2/_msearch?max_concurrent_shard_requests=5”,
“method”: “POST”,
“data”: “{“search_type”:“query_then_fetch”,“ignore_unavailable”:true,“index”:“lsf_job_acct*”}\n{“size”:0,“query”:{“bool”:{“filter”:[{“range”:{“event_time”:{“gte”:1598418487404,“lte”:1598429287404,“format”:“epoch_millis”}}},{“query_string”:{“analyze_wildcard”:true,“query”:”"}}],“must”:[{“match_phrase”:{“job_group”:{“query”:"/AA/BB/Job_Group_1"}}}]}},“aggs”:{“6”:{“terms”:{“field”:“user_name”,“size”:500,“order”:{"_key":“desc”},“min_doc_count”:0},“aggs”:{“8”:{“terms”:{“field”:“job_group”,“size”:500,“order”:{"_key":“desc”},“min_doc_count”:0},“aggs”:{“7”:{“terms”:{“field”:“job_status”,“size”:500,“order”:{"_key":“desc”},“min_doc_count”:0},“aggs”:{}}}}}}}}\n"
},
“response”: {
“took”: 6,
“responses”: [
{
“error”: {
“root_cause”: [
{
“type”: “array_index_out_of_bounds_exception”,
“reason”: “Index -1 out of bounds for length 1”
}
],
“type”: “search_phase_execution_exception”,
“reason”: “all shards failed”,
“phase”: “query”,
“grouped”: true,
“failed_shards”: [
{
“shard”: 0,
“index”: “lsf_job_acct-202008”,
“node”: “RmFuqUbWQV-7qm0b4E9rjg”,
“reason”: {
“type”: “array_index_out_of_bounds_exception”,
“reason”: “Index -1 out of bounds for length 1”
}
}
],
“caused_by”: {
“type”: “array_index_out_of_bounds_exception”,
“reason”: “Index -1 out of bounds for length 1”,
“caused_by”: {
“type”: “array_index_out_of_bounds_exception”,
“reason”: “Index -1 out of bounds for length 1”
}
}
},
“status”: 500
}
],
“$$config”: {
“url”: “api/datasources/proxy/2/_msearch?max_concurrent_shard_requests=5”,
“method”: “POST”,
“data”: "{“search_type”:“query_then_fetch”,“ignore_unavailable”:true,“index”:"lsf_job_acct
"}\n{“size”:0,“query”:{“bool”:{“filter”:[{“range”:{“event_time”:{“gte”:1598418487404,“lte”:1598429287404,“format”:“epoch_millis”}}},{“query_string”:{“analyze_wildcard”:true,“query”:"*"}}],“must”:[{“match_phrase”:{“job_group”:{“query”:"/AA/BB/Job_Group_1"}}}]}},“aggs”:{“6”:{“terms”:{“field”:“user_name”,“size”:500,“order”:{"_key":“desc”},“min_doc_count”:0},“aggs”:{“8”:{“terms”:{“field”:“job_group”,“size”:500,“order”:{"_key":“desc”},“min_doc_count”:0},“aggs”:{“7”:{“terms”:{“field”:“job_status”,“size”:500,“order”:{"_key":“desc”},“min_doc_count”:0},“aggs”:{}}}}}}}}\n"
}
}
}

Any ideas?

Thanks
W

1 Like

Please file a bug report for this.

Try to put

Min doc count : 1

Not 0

1 Like