All shards failed exception from elasticsearch aggregation query

Hi, I am trying to execute an aggregate query in which I am getting index_out_of_bounds_exception: null exception. I looked into stack trace of exception in elasticsearch logs but couldn't understand the proper cause.

Here is the sample query I am executing:

"aggregations": {
"MBC": {
  "terms": {
    "field": "cid_detail.id",
    "size": 3,
    "min_doc_count": 1,
    "shard_min_doc_count": 0,
    "show_term_doc_count_error": false,
    "order": [
      {
        "vCount": "desc"
      },
      {
        "_key": "asc"
      }
    ]
  },
  "aggregations": {
    "vCount": {
      "sum": {
        "field": "cid_detail.count"
      }
    }
  }
}
  }

cid_detail is an array of object, here is the sample format:

cid_detail:[
{
    "id": "a",
    "count": 5
},
  {  
   "id": "b",
    "count": 4 
   } 
]

I am attaching log trace of elasticsearch in comments.

Elasticsearch log trace:

Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Query Failed [Failed to execute main query]
            at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:298) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:110) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:279) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:312) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:288) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:284) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService$3.doRun(SearchService.java:964) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0.jar:6.0.0]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_111]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_111]
            at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
    Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: index_out_of_bounds_exception: null
            at java.nio.Buffer.checkIndex(Buffer.java:540) ~[?:1.8.0_111]
            at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:253) ~[?:1.8.0_111]
            at org.apache.lucene.store.ByteBufferGuard.getByte(ByteBufferGuard.java:118) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.apache.lucene.store.ByteBufferIndexInput$SingleBufferImpl.readByte(ByteBufferIndexInput.java:385) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.apache.lucene.codecs.lucene70.Lucene70DocValuesProducer$10.get(Lucene70DocValuesProducer.java:599) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.apache.lucene.codecs.lucene70.Lucene70DocValuesProducer$22.nextValue(Lucene70DocValuesProducer.java:1271) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.elasticsearch.index.fielddata.FieldData$SortedDoubleCastedValues.nextValue(FieldData.java:544) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.aggregations.metrics.sum.SumAggregator$1.collect(SumAggregator.java:78) ~[elasticsearch-6.0.0.jar:6.0.0]
    at org.elasticsearch.search.aggregations.LeafBucketCollector$2.collect(LeafBucketCollector.java:67) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.aggregations.LeafBucketCollector.collect(LeafBucketCollector.java:82) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.apache.lucene.search.MultiCollector$MultiLeafCollector.collect(MultiCollector.java:174) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreRange(Weight.java:208) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:195) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.apache.lucene.search.ReqExclBulkScorer.score(ReqExclBulkScorer.java:48) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:658) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:186) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:462) ~[lucene-core-7.0.1.jar:7.0.1 8d6c3889aa543954424d8ac1dbb3f03bf207140b - sarowe - 2017-10-02 14:36:35]
            at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:272) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:110) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:279) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:312) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:288) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:284) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.search.SearchService$3.doRun(SearchService.java:964) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) ~[elasticsearch-6.0.0.jar:6.0.0]
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0.jar:6.0.0]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_111]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_111]
            at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_111]

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