Arrayindexofbounds during aggregation

Hi,

Sometimes I get ArrayIndexofBounds exception during aggregation sometimes not.
(only the data is different.)
we use ES6.1.3 and elastic low level client 5.6.6. The cluster is upgraded from elastic 5.6.x.

Aggregation looks like:

  "query" : {
    "bool" : {
      "filter" : [
        {
          "term" : {
            "accountId" : {
              "value" : "1999002",
              "boost" : 1.0
            }
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true,
      "boost" : 1.0
    }
  },
  "aggregations" : {
    "messagesByFolders" : {
      "terms" : {
        "field" : "messages.folderId",
        "size" : 500,
        "min_doc_count" : 1,
        "shard_min_doc_count" : 0,
        "show_term_doc_count_error" : false,
        "order" : [
          {
            "_count" : "desc"
          },
          {
            "_term" : "asc"
          }
        ]
      },
      "aggregations" : {
        "unreadCount" : {
          "filter" : {
            "term" : {
              "messages.seen" : {
                "value" : false,
                "boost" : 1.0
              }
            }
          },
          "aggregations" : {
            "messagesByFolders" : {
              "terms" : {
                "field" : "messages.folderId",
                "size" : 500,
                "min_doc_count" : 1,
                "shard_min_doc_count" : 0,
                "show_term_doc_count_error" : false,
                "order" : [
                  {
                    "_count" : "desc"
                  },
                  {
                    "_term" : "asc"
                  }
                ]
              }
            }
          }
        }
      }
    }
  }
}

And the stack trace is the following:

    Message: : 61
    Stacktrace: Failed to execute phase [query], all shards failed; shardFailures {[sOTPyx0pTcyh3G6pSp7gsg][threads_550][16]: RemoteTransportException[[fmdev02][192.168.0.1                                                                     72:9300][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: ArrayIndexOutOfBoundsExcept                                                                     ion[61]; }
            at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:274)
            at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:132)
            at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:243)
            at org.elasticsearch.action.search.InitialSearchPhase.onShardFailure(InitialSearchPhase.java:107)
            at org.elasticsearch.action.search.InitialSearchPhase.access$100(InitialSearchPhase.java:49)
            at org.elasticsearch.action.search.InitialSearchPhase$2.lambda$onFailure$1(InitialSearchPhase.java:217)
            at org.elasticsearch.action.search.InitialSearchPhase.maybeFork(InitialSearchPhase.java:171)
            at org.elasticsearch.action.search.InitialSearchPhase.access$000(InitialSearchPhase.java:49)
            at org.elasticsearch.action.search.InitialSearchPhase$2.onFailure(InitialSearchPhase.java:217)
            at org.elasticsearch.action.search.SearchExecutionStatsCollector.onFailure(SearchExecutionStatsCollector.java:73)
            at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51)
            at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
            at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
            at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
            at 
org.elasticsearch.action.search.SearchPhaseExecutionException.writeTo(SearchPhaseExecutionException.java:61)
            at org.elasticsearch.common.io.stream.StreamOutput.writeException(StreamOutput.java:864)
            at org.elasticsearch.ElasticsearchException.writeTo(ElasticsearchException.java:285)
            at org.elasticsearch.transport.ActionTransportException.writeTo(ActionTransportException.java:59)
            at org.elasticsearch.common.io.stream.StreamOutput.writeException(StreamOutput.java:864)
            at org.elasticsearch.transport.TcpTransport.sendErrorResponse(TcpTransport.java:1149)
            at org.elasticsearch.transport.TcpTransportChannel.sendResponse(TcpTransportChannel.java:71)
            at org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:66)
            at org.elasticsearch.action.support.HandledTransportAction$TransportHandler$1.onFailure(HandledTransportAction.java:77)
            at org.elasticsearch.action.search.AbstractSearchAsyncAction.raisePhaseFailure(AbstractSearchAsyncAction.java:222)
            ... 44 more
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 61
            at org.apache.lucene.codecs.lucene54.Lucene54DocValuesProducer$14.nextValue(Lucene54DocValuesProducer.java:1263)
            at org.elasticsearch.search.aggregations.bucket.terms.LongTermsAggregator$1.collect(LongTermsAggregator.java:85)
  • Do you have any idea how to solve this problem?

Thx,

Hi, this is a lucene bug: https://issues.apache.org/jira/browse/LUCENE-8117. It will be fixed in the upcoming ES6.2 release.

Hi,

Thanks,

Can you suggest a workaround till then?
I guess that your linked bug is not totally the same. I used the elasticsearch5.5.6 client and it depends on the lucene 6.6.1 not on 7.x

Thx,

F.

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