I recently upgraded my Elasticsearch version from 5.6.x to 6.4.0 and since then, my query returns the following error:
{
"took": 6,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 3,
"skipped": 0,
"failed": 2,
"failures": [
{
"shard": 2,
"index": "my_index",
"node": "node_name",
"reason": {
"type": "index_out_of_bounds_exception",
"reason": null
}
}
]
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
},
"aggregations": {
"filtered-brands": {
"meta": {},
"doc_count": 0,
"attributes": {
"doc_count": 0,
"filtered-ids": {
"doc_count": 0,
"ids": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}
}
}
}
}
After some investigations, I noticed that the problem comes from one of my aggregation which is the following (if I remove it, it works):
"aggregations": {
"filtered-brands": {
"filter": {
"bool": {
"adjust_pure_negative": true,
"boost": 1
}
},
"aggregations": {
"attributes": {
"nested": {
"path": "attributes"
},
"aggregations": {
"filtered-ids": {
"filter": {
"term": {
"attributes.id": {
"value": "brand",
"boost": 1
}
}
},
"aggregations": {
"ids": {
"terms": {
"field": "attributes.id",
"size": 100,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_key": "asc"
}
]
},
"aggregations": {
"types": {
"terms": {
"field": "attributes.type",
"size": 100,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_key": "asc"
}
]
},
"aggregations": {
"avg_score": {
"avg": {
"script": {
"source": "_score",
"lang": "painless"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
If I remove the "avg_score" block, the query works fine. However, if I modify the aggregation into a much simpler one including the "avg_score" block, it works fine too. Thus I don't really know if it is the root of the problem.
Does anyone has experienced the same issue after upgrading to ES 6.x? If yes, any clues why this is happening?