Index out of bound exception on aggregation

Working on a small index that has 1556 documents. We are getting an exception when running the following:

GET search_stage_jacked_backup_3/_search?&error_trace=true
{
  "aggs": {
    "parentDealerName": {
      "terms": {
        "field": "parentDealerName.keyword",
        "missing": "None"
      }
    }
  },
  "size" : 0
}

Execption:
{
"error": {
"root_cause": [
{
"type": "array_index_out_of_bounds_exception",
"reason": "Index -1 out of bounds for length 1",
"stack_trace": "org.Elasticsearch.ElasticsearchException$1: Index -1 out of bounds for length 1\n\tat org.Elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:638)\n\tat org.Elasticsearch.action.search.SearchPhaseExecutionException.guessRootCauses(SearchPhaseExecutionException.java:150)\n\tat org.Elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:620)\n\tat org.Elasticsearch.ElasticsearchException.generateFailureXContent(ElasticsearchException.java:566)\n\tat org.Elasticsearch.rest.BytesRestResponse.build(BytesRestResponse.java:140)\n\tat org.Elasticsearch.rest.BytesRestResponse.(BytesRestResponse.java:101)\n\tat org.Elasticsearch.rest.BytesRestResponse.(BytesRestResponse.java:81)\n\tat org.Elasticsearch.rest.action.RestActionListener.onFailure(RestActionListener.java:55)\n\tat org.Elasticsearch.rest.action.RestCancellableNodeClient$1.onFailure(RestCancellableNodeClient.java:96)\n\tat org.Elasticsearch.client.node.NodeClient.lambda$executeLocally$1(NodeClient.java:114)\n\tat org.Elasticsearch.tasks.TaskManager$1.onFailure(TaskManager.java:185)\n\tat org.Elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:66)\n\tat org.Elasticsearch.action.ActionListener$RunAfterActionListener.onFailure(ActionListener.java:350)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.raisePhaseFailure(AbstractSearchAsyncAction.java:748)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:725)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:412)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:757)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:509)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:343)\n\tat org.Elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:66)\n\tat org.Elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:48)\n\tat org.Elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:651)\n\tat org.Elasticsearch.transport.TransportService$4.handleException(TransportService.java:719)\n\tat org.Elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1343)\n\tat org.Elasticsearch.transport.InboundHandler.lambda$handleException$3(InboundHandler.java:366)\n\tat org.Elasticsearch.common.util.concurrent.EsExecutors$DirectExecutorService.execute(EsExecutors.java:221)\n\tat org.Elasticsearch.transport.InboundHandler.handleException(InboundHandler.java:364)\n\tat org.Elasticsearch.transport.InboundHandler.handlerResponseError(InboundHandler.java:356)\n\tat org.Elasticsearch.transport.InboundHandler.messageReceived(InboundHandler.java:132)\n\tat org.Elasticsearch.transport.InboundHandler.inboundMessage(InboundHandler.java:88)\n\tat org.Elasticsearch.transport.TcpTransport.inboundMessage(TcpTransport.java:728)\n\tat org.Elasticsearch.transport.InboundPipeline.forwardFragments(InboundPipeline.java:148)\n\tat org.Elasticsearch.transport.InboundPipeline.doHandleBytes(InboundPipeline.java:120)\n\tat org.Elasticsearch.transport.InboundPipeline.handleBytes(InboundPipeline.java:85)\n\tat org.Elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:70)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)\n\tat io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)\n\tat io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:620)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:583)\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1\n\tat org.apache.lucene.util.packed.DirectMonotonicReader.get(DirectMonotonicReader.java:161)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.getTermFromIndex(Lucene90DocValuesProducer.java:1125)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekTermsIndex(Lucene90DocValuesProducer.java:1137)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekBlock(Lucene90DocValuesProducer.java:1163)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekCeil(Lucene90DocValuesProducer.java:1194)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$BaseSortedDocValues.lookupTerm(Lucene90DocValuesProducer.java:987)\n\tat org.apache.lucene.index.SingletonSortedSetDocValues.lookupTerm(SingletonSortedSetDocValues.java:100)\n\tat org.Elasticsearch.search.aggregations.support.MissingValues.replaceMissing(MissingValues.java:238)\n\tat org.Elasticsearch.search.aggregations.support.MissingValues$6.ordinalsValues(MissingValues.java:210)\n\tat org.Elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator$LowCardinality.getLeafCollector(GlobalOrdinalsStringTermsAggregator.java:306)\n\tat org.Elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:216)\n\tat org.Elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:94)\n\tat org.Elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:75)\n\tat org.apache.lucene.search.MultiCollector.getLeafCollector(MultiCollector.java:124)\n\tat org.Elasticsearch.search.internal.ContextIndexSearcher.searchLeaf(ContextIndexSearcher.java:182)\n\tat org.Elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:167)\n\tat org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:541)\n\tat org.Elasticsearch.search.query.QueryPhase.searchWithCollector(QueryPhase.java:232)\n\tat org.Elasticsearch.search.query.QueryPhase.executeInternal(QueryPhase.java:187)\n\tat org.Elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:88)\n\tat org.Elasticsearch.indices.IndicesService.lambda$loadIntoContext$26(IndicesService.java:1504)\n\tat org.Elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$27(IndicesService.java:1570)\n\tat org.Elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:178)\n\tat org.Elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:161)\n\tat org.Elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418)\n\tat org.Elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:124)\n\tat org.Elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1576)\n\tat org.Elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1498)\n\tat org.Elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:456)\n\tat org.Elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:621)\n\tat org.Elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:483)\n\tat org.Elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)\n\tat org.Elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)\n\tat org.Elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat org.Elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)\n\tat org.Elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:776)\n\tat org.Elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.lang.Thread.run(Thread.java:833)\n"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "search_stage_jacked_backup_3",
"node": "I3zlYuLGTqi6DtXxO49nRw",
"reason": {
"type": "array_index_out_of_bounds_exception",
"reason": "Index -1 out of bounds for length 1",
"stack_trace": "java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1... (removed for POST)"
}
}
],
"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",
"stack_trace": "java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1... (removed for POST)"
},
"stack_trace": "org.Elasticsearch.ElasticsearchException$1: Index -1 out of bounds for length 11... (removed for POST)"
},
"stack_trace": "Failed to execute phase [query], all shards failed; shardFailures {[I3zlYuLGTqi6DtXxO49nRw][search_stage_jacked_backup_3][0]: org.Elasticsearch.transport.RemoteTransportException: [es02][172.18.0.4:9300][indices:data/read/search[phase/query]]\nCaused by: org.Elasticsearch.search.query.QueryPhaseExecutionException: Query Failed [Failed to execute main query]\n\tat org.Elasticsearch.search.query.QueryPhase.executeInternal(QueryPhase.java:205)\n\tat org.Elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:88)\n\tat org.Elasticsearch.indices.IndicesService.lambda$loadIntoContext$26(IndicesService.java:1504)\n\tat org.Elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$27(IndicesService.java:1570)\n\tat org.Elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:178)\n\tat org.Elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:161)\n\tat org.Elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418)\n\tat org.Elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:124)\n\tat org.Elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1576)\n\tat org.Elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1498)\n\tat org.Elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:456)\n\tat org.Elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:621)\n\tat org.Elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:483)\n\tat org.Elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)\n\tat org.Elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)\n\tat org.Elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat org.Elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)\n\tat org.Elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:776)\n\tat org.Elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.lang.Thread.run(Thread.java:833)\nCaused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1\n\tat org.apache.lucene.util.packed.DirectMonotonicReader.get(DirectMonotonicReader.java:161)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.getTermFromIndex(Lucene90DocValuesProducer.java:1125)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekTermsIndex(Lucene90DocValuesProducer.java:1137)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekBlock(Lucene90DocValuesProducer.java:1163)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekCeil(Lucene90DocValuesProducer.java:1194)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$BaseSortedDocValues.lookupTerm(Lucene90DocValuesProducer.java:987)\n\tat org.apache.lucene.index.SingletonSortedSetDocValues.lookupTerm(SingletonSortedSetDocValues.java:100)\n\tat org.Elasticsearch.search.aggregations.support.MissingValues.replaceMissing(MissingValues.java:238)\n\tat org.Elasticsearch.search.aggregations.support.MissingValues$6.ordinalsValues(MissingValues.java:210)\n\tat org.Elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator$LowCardinality.getLeafCollector(GlobalOrdinalsStringTermsAggregator.java:306)\n\tat org.Elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:216)\n\tat org.Elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:94)\n\tat org.Elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:75)\n\tat org.apache.lucene.search.MultiCollector.getLeafCollector(MultiCollector.java:124)\n\tat org.Elasticsearch.search.internal.ContextIndexSearcher.searchLeaf(ContextIndexSearcher.java:182)\n\tat org.Elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:167)\n\tat org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:541)\n\tat org.Elasticsearch.search.query.QueryPhase.searchWithCollector(QueryPhase.java:232)\n\tat org.Elasticsearch.search.query.QueryPhase.executeInternal(QueryPhase.java:187)\n\t... 21 more\n}\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:725)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:412)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:757)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:509)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:343)\n\tat org.Elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:66)\n\tat org.Elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:48)\n\tat org.Elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:651)\n\tat org.Elasticsearch.transport.TransportService$4.handleException(TransportService.java:719)\n\tat org.Elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1343)\n\tat org.Elasticsearch.transport.InboundHandler.lambda$handleException$3(InboundHandler.java:366)\n\tat org.Elasticsearch.common.util.concurrent.EsExecutors$DirectExecutorService.execute(EsExecutors.java:221)\n\tat org.Elasticsearch.transport.InboundHandler.handleException(InboundHandler.java:364)\n\tat org.Elasticsearch.transport.InboundHandler.handlerResponseError(InboundHandler.java:356)\n\tat org.Elasticsearch.transport.InboundHandler.messageReceived(InboundHandler.java:132)\n\tat org.Elasticsearch.transport.InboundHandler.inboundMessage(InboundHandler.java:88)\n\tat org.Elasticsearch.transport.TcpTransport.inboundMessage(TcpTransport.java:728)\n\tat org.Elasticsearch.transport.InboundPipeline.forwardFragments(InboundPipeline.java:148)\n\tat org.Elasticsearch.transport.InboundPipeline.doHandleBytes(InboundPipeline.java:120)\n\tat org.Elasticsearch.transport.InboundPipeline.handleBytes(InboundPipeline.java:85)\n\tat org.Elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:70)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)\n\tat io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)\n\tat io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:620)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:583)\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: org.Elasticsearch.ElasticsearchException$1: Index -1 out of bounds for length 1\n\tat org.Elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:638)\n\tat org.Elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:410)\n\t... 42 more\nCaused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1\n\tat org.apache.lucene.util.packed.DirectMonotonicReader.get(DirectMonotonicReader.java:161)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.getTermFromIndex(Lucene90DocValuesProducer.java:1125)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekTermsIndex(Lucene90DocValuesProducer.java:1137)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekBlock(Lucene90DocValuesProducer.java:1163)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekCeil(Lucene90DocValuesProducer.java:1194)\n\tat org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$BaseSortedDocValues.lookupTerm(Lucene90DocValuesProducer.java:987)\n\tat org.apache.lucene.index.SingletonSortedSetDocValues.lookupTerm(SingletonSortedSetDocValues.java:100)\n\tat org.Elasticsearch.search.aggregations.support.MissingValues.replaceMissing(MissingValues.java:238)\n\tat org.Elasticsearch.search.aggregations.support.MissingValues$6.ordinalsValues(MissingValues.java:210)\n\tat org.Elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator$LowCardinality.getLeafCollector(GlobalOrdinalsStringTermsAggregator.java:306)\n\tat org.Elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:216)\n\tat org.Elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:94)\n\tat org.Elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:75)\n\tat org.apache.lucene.search.MultiCollector.getLeafCollector(MultiCollector.java:124)\n\tat org.Elasticsearch.search.internal.ContextIndexSearcher.searchLeaf(ContextIndexSearcher.java:182)\n\tat org.Elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:167)\n\tat org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:541)\n\tat org.Elasticsearch.search.query.QueryPhase.searchWithCollector(QueryPhase.java:232)\n\tat org.Elasticsearch.search.query.QueryPhase.executeInternal(QueryPhase.java:187)\n\tat org.Elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:88)\n\tat org.Elasticsearch.indices.IndicesService.lambda$loadIntoContext$26(IndicesService.java:1504)\n\tat org.Elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$27(IndicesService.java:1570)\n\tat org.Elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:178)\n\tat org.Elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:161)\n\tat org.Elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418)\n\tat org.Elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:124)\n\tat org.Elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1576)\n\tat org.Elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1498)\n\tat org.Elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:456)\n\tat org.Elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:621)\n\tat org.Elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:483)\n\tat org.Elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)\n\tat org.Elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)\n\tat org.Elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat org.Elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)\n\tat org.Elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:776)\n\tat org.Elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.lang.Thread.run(Thread.java:833)\n"
},
"status": 500
}

I am able to run the following and the new index can have the aggregation run on it without error:

POST _reindex
{
  "source": {
    "index": "search_stage_jacked_backup_3"
  },
  "dest": {
    "index": "search_stage_reindex_backup_3"
  }
}

Wrote an app that recursively tried run aggregation and then deleted a document. The "offending" document had the following value:
"parentDealerName" : null,

But that document can be posted to a good index and no problems running aggregation.

Mapping for property:

 "parentDealerName" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },

If I don't pass in "missing": "None" everything works fine.

Any ideas on how to trouble shoot/solve this problem would be greatly appreciated.

Thanks in advance

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

You seem to be hitting [LUCENE-10401] Seeking on empty doc-value terms dictionaries fails with AIOOBE - ASF JIRA, which got fixed in Lucene 9.1 / Elasticsearch 8.2. Upgrading should fix the problem.

1 Like