从Elasticsearch 5.6.x升级到6.4.0后的index_out_of_bounds_exception错误

时间:2018-09-04 05:21:11

标签: elasticsearch

我最近将我的Elasticsearch版本从5.6.x升级到了6.4.0,此后,我的查询返回以下错误:

{
  "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": []
          }
        }
      }
    }
  }
} 

这是完整的Stacktrace:

play.api.Application$$anon$1: Execution exception[[SearchPhaseExecutionException: all shards failed]]
    at play.api.Application$class.handleError(Application.scala:296)
    at play.api.DefaultApplication.handleError(Application.scala:402)
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320)
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320)
    at scala.Option.map(Option.scala:145)
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3.applyOrElse(PlayDefaultUpstreamHandler.scala:320)
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3.applyOrElse(PlayDefaultUpstreamHandler.scala:316)
    at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:344)
    at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:343)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:46)
    at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40)
    at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:248)
    at scala.concurrent.Promise$class.complete(Promise.scala:55)
    at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:23)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:293)
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:133)
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:254)
    at org.elasticsearch.action.search.InitialSearchPhase.onShardFailure(InitialSearchPhase.java:101)
    at org.elasticsearch.action.search.InitialSearchPhase.access$100(InitialSearchPhase.java:48)
    at org.elasticsearch.action.search.InitialSearchPhase$2.lambda$onFailure$1(InitialSearchPhase.java:222)
    at org.elasticsearch.action.search.InitialSearchPhase.maybeFork(InitialSearchPhase.java:176)
    at org.elasticsearch.action.search.InitialSearchPhase.access$000(InitialSearchPhase.java:48)
    at org.elasticsearch.action.search.InitialSearchPhase$2.onFailure(InitialSearchPhase.java:222)
    at org.elasticsearch.action.search.SearchExecutionStatsCollector.onFailure(SearchExecutionStatsCollector.java:73)
    at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51)
    at org.elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:526)
    at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1068)
    at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1165)
    at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1149)
    at org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:66)
    at org.elasticsearch.action.search.SearchTransportService$6$1.onFailure(SearchTransportService.java:384)
    at org.elasticsearch.search.SearchService$2.onFailure(SearchService.java:341)
    at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:335)
    at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:329)
    at org.elasticsearch.search.SearchService$3.doRun(SearchService.java:1019)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.lang.Thread.run(Thread.java:844)
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: : null
    at org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:657)
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:131)
    ... 26 common frames omitted
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: index_out_of_bounds_exception: null
    at java.nio.Buffer.checkIndex(Buffer.java:669)
    at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:265)
    at org.apache.lucene.store.ByteBufferGuard.getByte(ByteBufferGuard.java:118)
    at org.apache.lucene.store.ByteBufferIndexInput$SingleBufferImpl.readByte(ByteBufferIndexInput.java:385)
    at org.apache.lucene.codecs.lucene70.Lucene70NormsProducer$7.longValue(Lucene70NormsProducer.java:263)
    at org.apache.lucene.search.similarities.BM25Similarity$BM25DocScorer.score(BM25Similarity.java:257)
    at org.apache.lucene.search.TermScorer.score(TermScorer.java:65)
    at org.apache.lucene.search.DisjunctionSumScorer.score(DisjunctionSumScorer.java:39)
    at org.apache.lucene.search.DisjunctionScorer.score(DisjunctionScorer.java:180)
    at org.apache.lucene.search.FilterScorer.score(FilterScorer.java:59)
    at org.elasticsearch.common.lucene.search.function.FunctionScoreQuery$FunctionFactorScorer.score(FunctionScoreQuery.java:370)
    at org.apache.lucene.search.ConjunctionScorer.score(ConjunctionScorer.java:59)
    at org.apache.lucene.search.ScoreCachingWrappingScorer.score(ScoreCachingWrappingScorer.java:49)
    at org.elasticsearch.script.SearchScript.getScore(SearchScript.java:110)
    at org.elasticsearch.painless.ScriptImpl.run(ScriptImpl.java:105)
    at org.elasticsearch.search.aggregations.support.values.ScriptDoubleValues.advanceExact(ScriptDoubleValues.java:47)
    at org.elasticsearch.search.aggregations.metrics.avg.AvgAggregator$1.collect(AvgAggregator.java:83)
    at org.elasticsearch.search.aggregations.LeafBucketCollector$2.collect(LeafBucketCollector.java:67)
    at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:84)
    at org.elasticsearch.search.aggregations.bucket.terms.LongTermsAggregator$1.collect(LongTermsAggregator.java:91)
    at org.elasticsearch.search.aggregations.AggregatorFactory$MultiBucketAggregatorWrapper$1.collect(AggregatorFactory.java:140)
    at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:84)
    at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectBucket(BucketsAggregator.java:76)
    at org.elasticsearch.search.aggregations.bucket.filter.FilterAggregator$1.collect(FilterAggregator.java:66)
    at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:84)
    at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectBucket(BucketsAggregator.java:76)
    at org.elasticsearch.search.aggregations.bucket.filter.FilterAggregator$1.collect(FilterAggregator.java:66)
    at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:84)
    at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectBucket(BucketsAggregator.java:76)
    at org.elasticsearch.search.aggregations.bucket.nested.NestedAggregator$BufferingNestedLeafBucketCollector.processBufferedChildBuckets(NestedAggregator.java:183)
    at org.elasticsearch.search.aggregations.bucket.nested.NestedAggregator.processBufferedDocs(NestedAggregator.java:121)
    at org.elasticsearch.search.aggregations.bucket.nested.NestedAggregator.preGetSubLeafCollectors(NestedAggregator.java:111)
    at org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:165)
    at org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:166)
    at org.elasticsearch.search.aggregations.BucketCollector$2.getLeafCollector(BucketCollector.java:75)
    at org.elasticsearch.search.aggregations.BucketCollector$2.getLeafCollector(BucketCollector.java:69)
    at org.apache.lucene.search.MultiCollector.getLeafCollector(MultiCollector.java:121)
    at org.apache.lucene.search.FilterCollector.getLeafCollector(FilterCollector.java:40)
    at org.elasticsearch.search.query.CancellableCollector.getLeafCollector(CancellableCollector.java:51)
    at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:653)
    at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:191)
    at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:463)
    at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:266)
    at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:107)
    at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:324)
    at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:357)
    at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:333)
    ... 9 common frames omitted

经过一些调查,我发现问题来自以下一种聚合(如果我将其删除,则可以正常工作):

"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"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

如果我删除“ avg_score”块,则查询工作正常。但是,如果将聚合修改为一个更简单的聚合,包括“ avg_score”块,它也可以正常工作。因此,我真的不知道这是否是问题的根源。

在升级到ES 6.x之后,是否有人遇到过相同的问题?如果可以,那么为什么会发生这种情况?

0 个答案:

没有答案