Elastic search 8.5.3 Aggregations query erroring

Elastic search 8.5.3 not at all running aggregation queries , Even for small index ( just 5 documents )

Below Thread information.

Same query works perfectly fine in Elastic Search 7.17

 100.2% [cpu=100.2%, other=0.0%] (500.7ms out of 500ms) cpu usage by thread 'elasticsearch[<ec2-node>][search][T#10]'
     2/10 snapshots sharing following 59 elements
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewriteNoScoring(BooleanQuery.java:207)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:53)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewriteNoScoring(BooleanQuery.java:207)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:53)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:769)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.internal.ContextIndexSearcher.rewrite(ContextIndexSearcher.java:135)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.QueryToFilterAdapter.union(QueryToFilterAdapter.java:127)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.FilterByFilterAggregator$AdapterBuilder.add(FilterByFilterAggregator.java:103)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.FilterByFilterAggregator$AdapterBuilder.add(FilterByFilterAggregator.java:96)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregatorFromFilters.adaptIntoFiltersOrNull(StringTermsAggregatorFromFilters.java:112)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$ExecutionMode$2.create(TermsAggregatorFactory.java:430)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.lambda$bytesSupplier$0(TermsAggregatorFactory.java:135)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$$Lambda$2253/0x00000008017cc838.build(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.doCreateInternal(TermsAggregatorFactory.java:308)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory.createInternal(ValuesSourceAggregatorFactory.java:41)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactory.create(AggregatorFactory.java:81)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactories.createSubAggregators(AggregatorFactories.java:233)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactories.createTopLevelAggregators(AggregatorFactories.java:243)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregationPhase.preProcess(AggregationPhase.java:38)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:79)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$29(IndicesService.java:1517)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService$$Lambda$7961/0x00000008024a2d98.accept(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$30(IndicesService.java:1583)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService$$Lambda$7962/0x00000008024a34b0.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:176)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:159)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:122)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1589)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1511)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:462)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:627)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:489)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService$$Lambda$7564/0x00000008023f4440.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService$$Lambda$7567/0x00000008023f4c80.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:892)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
       java.base@19.0.1/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
       java.base@19.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
       java.base@19.0.1/java.lang.Thread.run(Thread.java:1589)
     2/10 snapshots sharing following 57 elements
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewriteNoScoring(BooleanQuery.java:207)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:53)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewriteNoScoring(BooleanQuery.java:207)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:53)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:769)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.internal.ContextIndexSearcher.rewrite(ContextIndexSearcher.java:135)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.QueryToFilterAdapter.union(QueryToFilterAdapter.java:127)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.FilterByFilterAggregator$AdapterBuilder.add(FilterByFilterAggregator.java:103)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.FilterByFilterAggregator$AdapterBuilder.add(FilterByFilterAggregator.java:96)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregatorFromFilters.adaptIntoFiltersOrNull(StringTermsAggregatorFromFilters.java:112)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$ExecutionMode$2.create(TermsAggregatorFactory.java:430)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.lambda$bytesSupplier$0(TermsAggregatorFactory.java:135)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$$Lambda$2253/0x00000008017cc838.build(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.doCreateInternal(TermsAggregatorFactory.java:308)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory.createInternal(ValuesSourceAggregatorFactory.java:41)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactory.create(AggregatorFactory.java:81)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactories.createSubAggregators(AggregatorFactories.java:233)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactories.createTopLevelAggregators(AggregatorFactories.java:243)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregationPhase.preProcess(AggregationPhase.java:38)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:79)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$29(IndicesService.java:1517)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService$$Lambda$7961/0x00000008024a2d98.accept(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$30(IndicesService.java:1583)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService$$Lambda$7962/0x00000008024a34b0.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:176)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:159)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:122)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1589)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1511)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:462)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:627)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:489)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService$$Lambda$7564/0x00000008023f4440.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService$$Lambda$7567/0x00000008023f4c80.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:892)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
       java.base@19.0.1/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
       java.base@19.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
       java.base@19.0.1/java.lang.Thread.run(Thread.java:1589)
     2/10 snapshots sharing following 59 elements
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewriteNoScoring(BooleanQuery.java:207)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:53)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:769)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.internal.ContextIndexSearcher.rewrite(ContextIndexSearcher.java:135)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.QueryToFilterAdapter.union(QueryToFilterAdapter.java:127)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.FilterByFilterAggregator$AdapterBuilder.add(FilterByFilterAggregator.java:103)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.FilterByFilterAggregator$AdapterBuilder.add(FilterByFilterAggregator.java:96)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregatorFromFilters.adaptIntoFiltersOrNull(StringTermsAggregatorFromFilters.java:112)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$ExecutionMode$2.create(TermsAggregatorFactory.java:430)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.lambda$bytesSupplier$0(TermsAggregatorFactory.java:135)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$$Lambda$2253/0x00000008017cc838.build(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.doCreateInternal(TermsAggregatorFactory.java:308)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory.createInternal(ValuesSourceAggregatorFactory.java:41)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactory.create(AggregatorFactory.java:81)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactories.createSubAggregators(AggregatorFactories.java:233)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactories.createTopLevelAggregators(AggregatorFactories.java:243)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregationPhase.preProcess(AggregationPhase.java:38)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:79)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$29(IndicesService.java:1517)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService$$Lambda$7961/0x00000008024a2d98.accept(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$30(IndicesService.java:1583)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService$$Lambda$7962/0x00000008024a34b0.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:176)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:159)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:122)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1589)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1511)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:462)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:627)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:489)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService$$Lambda$7564/0x00000008023f4440.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService$$Lambda$7567/0x00000008023f4c80.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:892)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
       java.base@19.0.1/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
       java.base@19.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
       java.base@19.0.1/java.lang.Thread.run(Thread.java:1589)
     4/10 snapshots sharing following 55 elements
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewriteNoScoring(BooleanQuery.java:207)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:53)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:280)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.ConstantScoreQuery.rewrite(ConstantScoreQuery.java:44)
       app/org.apache.lucene.core@9.4.2/org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:769)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.internal.ContextIndexSearcher.rewrite(ContextIndexSearcher.java:135)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.QueryToFilterAdapter.union(QueryToFilterAdapter.java:127)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.FilterByFilterAggregator$AdapterBuilder.add(FilterByFilterAggregator.java:103)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.filter.FilterByFilterAggregator$AdapterBuilder.add(FilterByFilterAggregator.java:96)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregatorFromFilters.adaptIntoFiltersOrNull(StringTermsAggregatorFromFilters.java:112)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$ExecutionMode$2.create(TermsAggregatorFactory.java:430)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.lambda$bytesSupplier$0(TermsAggregatorFactory.java:135)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory$$Lambda$2253/0x00000008017cc838.build(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.doCreateInternal(TermsAggregatorFactory.java:308)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory.createInternal(ValuesSourceAggregatorFactory.java:41)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactory.create(AggregatorFactory.java:81)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactories.createSubAggregators(AggregatorFactories.java:233)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregatorFactories.createTopLevelAggregators(AggregatorFactories.java:243)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.aggregations.AggregationPhase.preProcess(AggregationPhase.java:38)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:79)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$29(IndicesService.java:1517)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService$$Lambda$7961/0x00000008024a2d98.accept(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$30(IndicesService.java:1583)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService$$Lambda$7962/0x00000008024a34b0.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:176)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:159)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:122)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1589)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1511)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:462)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:627)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:489)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService$$Lambda$7564/0x00000008023f4440.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.search.SearchService$$Lambda$7567/0x00000008023f4c80.get(Unknown Source)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:892)
       app/org.elasticsearch.server@8.5.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
       java.base@19.0.1/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
       java.base@19.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
       java.base@19.0.1/java.lang.Thread.run(Thread.java:1589)

Welcome to our community! :smiley:

That is not an error, it's the hot threads output, so it's not really clear what you are asking sorry. It'd help if you shared the full query and the full error.

Query does not return response also it ending Timeout. Index has only 5 documents.

[indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Query Failed [Failed to execute main query]
	at org.elasticsearch.search.query.QueryPhase.executeInternal(QueryPhase.java:197) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:80) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$29(IndicesService.java:1517) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$30(IndicesService.java:1583) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:176) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:159) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:122) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1589) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1511) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:462) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:627) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:489) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:892) ~[elasticsearch-8.5.3.jar:?]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.5.3.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.lang.Thread.run(Thread.java:1589) ~[?:?]

same query works fine in 7.17 and same schema we used for 8.5.3 to load few documents to test but query not at all completing.

You haven't shown us the query though.

[2023-04-25T23:21:57,430][DEBUG][o.e.a.s.TransportSearchAction] [<node>] [MUBuM7mcSeW9IuGX2zv0EQ][test][0]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[test], indicesOptions=IndicesOptions[ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, expand_wildcards_hidden=false, allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false, ignore_throttled=true], routing='null', preference='null', requestCache=null, scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=null, allowPartialSearchResults=true, localClusterAlias=null, getOrCreateAbsoluteStartMillis=-1, ccsMinimizeRoundtrips=true, source={"from":0,"size":0,"query":{"bool":{"must":[{"query_string":{"query":"((((((((((((((((((((((authorAffiliationGroup:\"tianjin\\ univ.\" OR authorAffiliationGroup:\"tian\\ jin\\ univ.\" OR authorAffiliationGroup:\"tianjing\\ univ.\" OR authorAffiliationGroup:\"tian\\ jing\\ univ.\" OR authorAffiliationGroup:\"tianjin\\ university\" OR authorAffiliationGroup:\"tian\\ jin\\ university\" OR authorAffiliationGroup:\"tianjing\\ university\" OR authorAffiliationGroup:\"tian\\ jing\\ university\" OR authorAffiliationGroup:\"300072\" OR authorAffiliationGroup:\"300350\" OR authorAffiliationGroup:\"300354\" OR affiliationId:60019533) AND (publicationYear:2024 OR publicationYear:2023 OR publicationYear:2022 OR publicationYear:2021)) AND NOT(controlledVocabularyGroup.exact:\"efficiency\")) AND NOT(controlledVocabularyGroup.exact:\"catalyst activity\")) AND NOT(classificationCode.agg:\"931.4\")) AND NOT(classificationCode.agg:\"922.1\")) AND NOT(classificationCode.agg:\"741.3\")) AND NOT(classificationCode.agg:\"921.5\")) AND NOT(isOpenAccess.agg:\"publisherfree2read\")) AND NOT(classificationCode.agg:\"961\")) AND NOT(classificationCode.agg:\"714.2\")) AND NOT(authorEditorAffiliation.agg:\"school of chemical engineering and technology, tianjin university\")) AND NOT(rectype.agg:\"ip\")) AND NOT(classificationCode.agg:\"933\")) AND NOT(classificationCode.agg:\"931.1\")) AND NOT(classificationCode.agg:\"631.1\")) AND NOT(classificationCode.agg:\"815.1.1\")) AND NOT(classificationCode.agg:\"723\")) AND NOT(classificationCode.agg:\"723.4\")) AND NOT(classificationCode.agg:\"461.6\")) AND NOT(classificationCode.agg:\"716.1\")) AND NOT(classificationCode.agg:\"741.1\"))","fields":["abstract^8.0","all^1.0","controlledTerms^25.0","title^100.0","uncontrolledTerms^25.0"],"type":"most_fields","tie_breaker":1.0,"default_operator":"and"}}],"boost":1.0}},"aggregations":{"dbnav":{"terms":{"field":"database.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"aunav":{"terms":{"field":"authorEditors.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"afnav":{"terms":{"field":"authorEditorAffiliation.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"cvnav":{"terms":{"field":"controlledVocabulary.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"clnav":{"terms":{"field":"classificationCode.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"conav":{"terms":{"field":"country.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"dtnav":{"terms":{"field":"rectype.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"lanav":{"terms":{"field":"language.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"yrnav":{"terms":{"field":"publicationYear","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":{"_key":"desc"}}},"stnav":{"terms":{"field":"serialTitles.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"pnnav":{"terms":{"field":"publisherName.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"gagnav":{"terms":{"field":"grantAgency.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"nunav":{"terms":{"field":"numericalUnits.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"ssnav":{"terms":{"field":"sourceBibText.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}},"oanav":{"terms":{"field":"isOpenAccess.agg","size":160,"shard_size":5000,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"_count":"desc"},{"_key":"asc"}]}}}}}] lastShard [true]
org.elasticsearch.transport.RemoteTransportException: [node][node][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Query Failed [Failed to execute main query]
  at org.elasticsearch.search.query.QueryPhase.executeInternal(QueryPhase.java:197) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:80) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$29(IndicesService.java:1517) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$30(IndicesService.java:1583) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:176) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:159) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:418) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:122) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1589) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1511) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:462) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:627) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:489) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:892) ~[elasticsearch-8.5.3.jar:?]
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.5.3.jar:?]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
  at java.lang.Thread.run(Thread.java:1589) ~[?:?]

Same query works fine in 7.17.4 but 8.5.3 not working for even empty index.

Can you please show the query, these are logs not the json query you are sending.

{
  "from": 0,
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "(((((((((((((((((((((((((((((((authorAffiliationGroup:\"tianjin\\ univ.\" OR authorAffiliationGroup:\"tian\\ jin\\ univ.\" OR authorAffiliationGroup:\"tianjing\\ univ.\" OR authorAffiliationGroup:\"tian\\ jing\\ univ.\" OR authorAffiliationGroup:\"tianjin\\ university\" OR authorAffiliationGroup:\"tian\\ jin\\ university\" OR authorAffiliationGroup:\"tianjing\\ university\" OR authorAffiliationGroup:\"tian\\ jing\\ university\" OR authorAffiliationGroup:\"300072\" OR authorAffiliationGroup:\"300350\" OR authorAffiliationGroup:\"300354\" OR affiliationId:60019533) AND (publicationYear:2024 OR publicationYear:2023 OR publicationYear:2022 OR publicationYear:2021)) AND NOT(controlledVocabularyGroup.exact:\"efficiency\")) AND NOT(controlledVocabularyGroup.exact:\"catalyst activity\")) AND NOT(classificationCode.agg:\"931.4\")) AND NOT(classificationCode.agg:\"922.1\")) AND NOT(classificationCode.agg:\"741.3\")) AND NOT(classificationCode.agg:\"921.5\")) AND NOT(isOpenAccess.agg:\"publisherfree2read\")) AND NOT(classificationCode.agg:\"961\")) AND NOT(classificationCode.agg:\"714.2\")) AND NOT(authorEditorAffiliation.agg:\"school of chemical engineering and technology, tianjin university\")) AND NOT(rectype.agg:\"ip\")) AND NOT(classificationCode.agg:\"933\")) AND NOT(classificationCode.agg:\"931.1\")) AND NOT(classificationCode.agg:\"631.1\")) AND NOT(classificationCode.agg:\"815.1.1\")) AND NOT(classificationCode.agg:\"723\")) AND NOT(classificationCode.agg:\"723.4\")) AND NOT(classificationCode.agg:\"461.6\")) AND NOT(classificationCode.agg:\"716.1\")) AND NOT(classificationCode.agg:\"741.1\")) AND NOT(classificationCode.agg:\"801.4\")) AND NOT(classificationCode.agg:\"641.1\")) AND NOT(classificationCode.agg:\"921\")) AND NOT(classificationCode.agg:\"931.2\" OR classificationCode.agg:\"702.1.2\")) AND NOT(classificationCode.agg:\"802.3\")) AND NOT(classificationCode.agg:\"951\")) AND NOT(classificationCode.agg:\"804.2\")) AND NOT(publicationYear:2023)) AND publisherName.agg:\"elsevier ltd\") AND (publicationYear:[1666 TO *] AND publicationYear:[* TO 2033] AND publicationYear:[1884 TO 2023]) AND database:cpx",
            "fields": [
              "abstract^8.0",
              "all^1.0",
              "controlledTerms^25.0",
              "title^100.0",
              "uncontrolledTerms^25.0"
            ],
            "type": "most_fields",
            "tie_breaker": 1.0,
            "default_operator": "and"
          }
        }
      ],
      "boost": 1.0
    }
  },
  "aggregations": {
    "dbnav": {
      "terms": {
        "field": "database.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "aunav": {
      "terms": {
        "field": "authorEditors.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "afnav": {
      "terms": {
        "field": "authorEditorAffiliation.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "cvnav": {
      "terms": {
        "field": "controlledVocabulary.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "clnav": {
      "terms": {
        "field": "classificationCode.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "conav": {
      "terms": {
        "field": "country.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "dtnav": {
      "terms": {
        "field": "rectype.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "lanav": {
      "terms": {
        "field": "language.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "yrnav": {
      "terms": {
        "field": "publicationYear",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": { "_key": "desc" }
      }
    },
    "stnav": {
      "terms": {
        "field": "serialTitles.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "pnnav": {
      "terms": {
        "field": "publisherName.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "gagnav": {
      "terms": {
        "field": "grantAgency.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "nunav": {
      "terms": {
        "field": "numericalUnits.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "ssnav": {
      "terms": {
        "field": "sourceBibText.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    },
    "oanav": {
      "terms": {
        "field": "isOpenAccess.agg",
        "size": 160,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [{ "_count": "desc" }, { "_key": "asc" }]
      }
    }
  }
}

we do not find any way to debug this why it is not responding in ES 8.5.3 what changes needs to be done to this work same as ES - 7.17.4.

I think you are hitting a similar issue described here and probably the workaround helps you:

Would it be possible for you to open an issue in the Elasticsearch repository providing as much information so we can reproduce it?

Thanks!

Same query works fine in 8.0.0. and 8.2.0 but it does not work 8.5.3 onwards. Above your work around did not help in 8.5.3.

Reproduced with simple Index and sample query:
Schema

PUT /testindex
{
  "settings": {
    "index": {
      "refresh_interval": "30s",
      "number_of_shards": 1,
      "number_of_replicas": 0,
      "query.default_field": "fieldName"
    }
  },
  "mappings": {
    "dynamic": false,
    "_source": {
      "includes": [
        "fieldName"
      ]
    },
    "properties": {
      "fieldName": {
        "type": "keyword",
        "eager_global_ordinals": true
      },
      "year":{
         "type":"integer"
      }
    }
  }
}

Query
POST /testindex/_search

{
  "from": 0,
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "(((((((((((((((((((((((((((((((fieldName:\"a\" OR fieldName:\"a b\" OR fieldName:\"ab\" OR fieldName:\"a b c\" OR fieldName:\"abc\" OR fieldName:\"ab c\" OR fieldName:\"a bc\" OR fieldName:\"abc\" OR fieldName:\"ab cd\" OR fieldName:\"abcd\" OR fieldName:\"a b c d\" OR fieldName:abcd) AND (fieldName:test OR fieldName:test1 OR fieldName:test2 OR fieldName:test3)) AND NOT(fieldName:\"xyz\")) AND NOT(fieldName:\"wer vity\")) AND NOT(fieldName:\"931.4\")) AND NOT(fieldName:\"922.1\")) AND NOT(fieldName:\"741.3\")) AND NOT(fieldName:\"921.5\")) AND NOT(fieldName:\"ghj jj\")) AND NOT(fieldName:\"961\")) AND NOT(fieldName:\"714.2\")) AND NOT(fieldName:\"school\")) AND NOT(fieldName:\"ip\")) AND NOT(fieldName:\"933\")) AND NOT(fieldName:\"931.1\")) AND NOT(fieldName:\"631.1\")) AND NOT(fieldName:\"815.1.1\")) AND NOT(fieldName:\"723\")) AND NOT(fieldName:\"723.4\")) AND NOT(fieldName:\"461.6\")) AND NOT(fieldName:\"716.1\")) AND NOT(fieldName:\"741.1\")) AND NOT(fieldName:\"801.4\")) AND NOT(fieldName:\"641.1\")) AND NOT(fieldName:\"921\")) AND NOT(fieldName:\"931.2\" OR fieldName:\"702.1.2\")) AND NOT(fieldName:\"802.3\")) AND NOT(fieldName:\"951\")) AND NOT(fieldName:\"804.2\")) AND NOT(year:2023)) AND fieldName:\"ltd\") AND (year:[1666 TO *] AND year:[* TO 2033] AND year:[1884 TO 2023]) AND fieldName:testPerformannce",
            "fields": [
              "abs^1.0",
              "all^1.0",
              "itemtitle^1.0"
            ],
            "type": "most_fields",
            "tie_breaker": 1,
            "default_operator": "and",
            "max_determinized_states": 10000,
            "enable_position_increments": true,
            "fuzziness": "AUTO",
            "fuzzy_prefix_length": 0,
            "fuzzy_max_expansions": 50,
            "phrase_slop": 0,
            "escape": false,
            "auto_generate_synonyms_phrase_query": true,
            "fuzzy_transpositions": true,
            "boost": 1
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  },
  "aggregations": {
    "testCarmen": {
      "terms": {
        "field": "fieldName",
        "size": 100,
        "shard_size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [
          {
            "_count": "desc"
          },
          {
            "_key": "asc"
          }
        ]
      }
    }
  }
}```

That was very useful. I could reproduce it in 8.5.3 up to 8.6.2 but it seems to have been fixed in 8.7.0. I am afraid in order to fix it you will need to upgrade to 8.7+.

The issue was fixed in lucene here: Fix exponential runtime for Boolean#rewrite by benwtrent · Pull Request #12072 · apache/lucene · GitHub

And probably was introduced by some optimisation that combines the query and the terms aggregations to avoid visiting all documents.

hope this helps.

thanks a lot for your response and details. You are right. it is fixed in 8.7.0. we tested and we are moving forward with that latest version. But out of curiosity how to debug this kind of query to avoid wasting lots of time . this kind of query not even reaching server logs even enabling slow logs 0ms. we were literally struggling to debug what could be the reason . we followed all Elastic documentation but no where we got help.
Please share some details to debug these kind of queries and all.

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