# Index out of bounds error after upgrade from 5.6.x to 6.4.0

**URL:** <https://discuss.elastic.co/t/index-out-of-bounds-error-after-upgrade-from-5-6-x-to-6-4-0/147139>\
**Category:** Elasticsearch\
**Created:** [September 4, 2018, 5:23am UTC](https://discuss.elastic.co/t/index-out-of-bounds-error-after-upgrade-from-5-6-x-to-6-4-0/147139 "2018-09-04T05:23:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevtomba](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@Kevtomba](https://discuss.elastic.co/u/Kevtomba)\
**Post date:** [September 4, 2018, 5:23am UTC](https://discuss.elastic.co/t/index-out-of-bounds-error-after-upgrade-from-5-6-x-to-6-4-0/147139/1 "2018-09-04T05:23:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 2, 2018, 5:27am UTC](https://discuss.elastic.co/t/index-out-of-bounds-error-after-upgrade-from-5-6-x-to-6-4-0/147139/2 "2018-10-02T05:27:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
