Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexOutOfBoundsException fetch innerhits #93117

Closed
AlexanderOtt85 opened this issue Jan 20, 2023 · 5 comments · Fixed by #93340
Closed

IndexOutOfBoundsException fetch innerhits #93117

AlexanderOtt85 opened this issue Jan 20, 2023 · 5 comments · Fixed by #93340
Assignees
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@AlexanderOtt85
Copy link

Elasticsearch Version

8.6.0

Installed Plugins

No response

Java Version

bundled

OS Version

docker-image = docker.elastic.co/elasticsearch/elasticsearch:8.6

Problem Description

We are trying to migrate from Elasticsearch 6.7.1 to Elasticsearch 8.6.0.

With the same document we always get IndexOutOfBoundsException while trying to fetch innerhits in Elasticsearch 8.6.0. Everything works fine in Elasticsearch 6.7.1.

Steps to Reproduce

elasticsearch_6.7.1 (1).txt
elasticsearch_8.6.0.txt

Logs (if relevant)

{"@timestamp":"2023-01-20T13:39:21.170Z", "log.level": "WARN", "message":"path: /test/_search, params: {index=test}", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es01][search][T#10]","log.logger":"rest.suppressed","elasticsearch.cluster.uuid":"T3_Kb_fZTOORKN7Bn5jz2g","elasticsearch.node.id":"fESFHfZ-RxuDaPIIKhOoNA","elasticsearch.node.name":"es01","elasticsearch.cluster.name":"es_alex","error.type":"org.elasticsearch.action.search.SearchPhaseExecutionException","error.message":"all shards failed","error.stack_trace":"Failed to execute phase [query], all shards failed; shardFailures {[fESFHfZ-RxuDaPIIKhOoNA][test][0]: org.elasticsearch.transport.RemoteTransportException: [es01][172.27.0.2:9300][indices:data/read/search[phase/query]]\nCaused by: org.elasticsearch.search.fetch.FetchPhaseExecutionException: Fetch Failed [Error running fetch phase for doc [73]]\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:181)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:93)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:659)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:634)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:489)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:769)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: org.elasticsearch.search.fetch.FetchPhaseExecutionException: Fetch Failed [Error running fetch phase for doc [43]]\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:181)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:93)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.subphase.InnerHitsPhase.hitExecute(InnerHitsPhase.java:76)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.subphase.InnerHitsPhase$1.process(InnerHitsPhase.java:52)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:177)\n\t... 13 more\nCaused by: java.lang.IndexOutOfBoundsException: Index: 43, Size: 1\n\tat java.base/java.util.Collections$SingletonList.get(Collections.java:4959)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.prepareNestedHitContext(FetchPhase.java:466)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.prepareHitContext(FetchPhase.java:312)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:165)\n\t... 17 more\n}\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:728)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:418)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:760)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:512)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:349)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:92)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:48)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:642)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.transport.TransportService$UnregisterChildTransportResponseHandler.handleException(TransportService.java:1650)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1390)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1512)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1487)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:50)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.support.ChannelActionListener.onFailure(ChannelActionListener.java:48)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.ActionRunnable.onFailure(ActionRunnable.java:77)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:28)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:769)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: org.elasticsearch.ElasticsearchException$1: Index: 43, Size: 1\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:638)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:416)\n\t... 20 more\nCaused by: java.lang.IndexOutOfBoundsException: Index: 43, Size: 1\n\tat java.base/java.util.Collections$SingletonList.get(Collections.java:4959)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.prepareNestedHitContext(FetchPhase.java:466)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.prepareHitContext(FetchPhase.java:312)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:165)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:93)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.subphase.InnerHitsPhase.hitExecute(InnerHitsPhase.java:76)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.subphase.InnerHitsPhase$1.process(InnerHitsPhase.java:52)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:177)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:93)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:659)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:634)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:489)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)\n\tat org.elasticsearch.server@8.4.3/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\t... 6 more\n"}

@AlexanderOtt85 AlexanderOtt85 added >bug needs:triage Requires assignment of a team area label labels Jan 20, 2023
@dnhatn dnhatn added the Team:Search Meta label for search team label Jan 21, 2023
@elasticsearchmachine elasticsearchmachine removed the Team:Search Meta label for search team label Jan 21, 2023
@AlexanderOtt85
Copy link
Author

Any updates about this issue?

@michaelbaamonde michaelbaamonde added :Search/Search Search-related issues that do not fall into other categories and removed needs:triage Requires assignment of a team area label labels Jan 24, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Jan 24, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@romseygeek
Copy link
Contributor

Thanks for reporting! It looks from the stack trace as though you're using elasticsearch 8.4.3, not 8.6? This area of the code has seen a lot of changes recently so it's difficult to work out what the error might be. Can you try it on 8.6 and see if you get the same problem, and if so post the stack trace again?

@AlexanderOtt85
Copy link
Author

Sorry for that. i tried different version but the problem is still there in 8.6

{"@timestamp":"2023-01-25T13:50:02.959Z", "log.level": "WARN", "message":"path: /test/_search, params: {index=test}", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es01][search][T#6]","log.logger":"rest.suppressed","elasticsearch.cluster.uuid":"7Hz2sDMvSNeClK1GRPd69Q","elasticsearch.node.id":"7A-7LtesQDWpjFLkYVr6RA","elasticsearch.node.name":"es01","elasticsearch.cluster.name":"es_alex","error.type":"org.elasticsearch.action.search.SearchPhaseExecutionException","error.message":"all shards failed","error.stack_trace":"Failed to execute phase [query], all shards failed; shardFailures {[7A-7LtesQDWpjFLkYVr6RA][test][0]: org.elasticsearch.transport.RemoteTransportException: [es01][192.168.16.2:9300][indices:data/read/search[phase/query]]\nCaused by: org.elasticsearch.search.fetch.FetchPhaseExecutionException: Fetch Failed [Error running fetch phase for doc [75]]\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhaseDocsIterator.iterate(FetchPhaseDocsIterator.java:73)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:151)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:80)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:672)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:644)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:495)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:917)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1589)\nCaused by: org.elasticsearch.search.fetch.FetchPhaseExecutionException: Fetch Failed [Error running fetch phase for doc [43]]\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhaseDocsIterator.iterate(FetchPhaseDocsIterator.java:73)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:151)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:80)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.subphase.InnerHitsPhase.hitExecute(InnerHitsPhase.java:96)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.subphase.InnerHitsPhase$1.process(InnerHitsPhase.java:62)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase$1.nextDoc(FetchPhase.java:145)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhaseDocsIterator.iterate(FetchPhaseDocsIterator.java:70)\n\t... 15 more\nCaused by: java.lang.IndexOutOfBoundsException: Index: 43, Size: 1\n\tat java.base/java.util.Collections$SingletonList.get(Collections.java:4959)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.prepareNestedHitContext(FetchPhase.java:341)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.prepareHitContext(FetchPhase.java:204)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase$1.nextDoc(FetchPhase.java:134)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhaseDocsIterator.iterate(FetchPhaseDocsIterator.java:70)\n\t... 21 more\n}\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:728)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:418)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:760)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:512)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:349)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:92)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:48)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:642)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.transport.TransportService$UnregisterChildTransportResponseHandler.handleException(TransportService.java:1646)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1372)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1508)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1483)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:50)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.support.ChannelActionListener.onFailure(ChannelActionListener.java:48)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionRunnable.onFailure(ActionRunnable.java:92)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:28)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:917)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1589)\nCaused by: org.elasticsearch.ElasticsearchException$1: Index: 43, Size: 1\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:640)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:416)\n\t... 20 more\nCaused by: java.lang.IndexOutOfBoundsException: Index: 43, Size: 1\n\tat java.base/java.util.Collections$SingletonList.get(Collections.java:4959)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.prepareNestedHitContext(FetchPhase.java:341)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.prepareHitContext(FetchPhase.java:204)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase$1.nextDoc(FetchPhase.java:134)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhaseDocsIterator.iterate(FetchPhaseDocsIterator.java:70)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:151)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:80)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.subphase.InnerHitsPhase.hitExecute(InnerHitsPhase.java:96)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.subphase.InnerHitsPhase$1.process(InnerHitsPhase.java:62)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase$1.nextDoc(FetchPhase.java:145)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhaseDocsIterator.iterate(FetchPhaseDocsIterator.java:70)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:151)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:80)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:672)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:644)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:495)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)\n\tat org.elasticsearch.server@8.6.0/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\t... 6 more\n"}

@romseygeek
Copy link
Contributor

Thanks, that makes it a lot easier to track down! So I think the issue is that the nested source is not in the shape that we are expecting it. The error is caused by the source processing code trying to extract the 43rd child doc from the root source, but the source itself thinks that it has only one child, hence:

java.lang.IndexOutOfBoundsException: Index: 43, Size: 1
    at java.base/java.util.Collections$SingletonList.get(Collections.java:4959)

I think it's going to be something to do with the multiple nesting and mix of object and array notation in your example document, but you've given me enough to work out what is going on and I will work on a fix.

@romseygeek romseygeek self-assigned this Jan 26, 2023
romseygeek added a commit that referenced this issue Feb 1, 2023
When executing the copy_to mappings on a nested doc, if the location was
underneath another nested mapper then the document parser could end up
adding a new nested path metadata field for the source to the destination
document. This was mostly ignored, but could make calculation of a
NestedIdentity incorrect, leading to exceptions when loading the source of
a nested document during the fetch phase.

This commit moves all of the nested path handling directly into
DocumentParserContext.createNestedContext(), which already has some
logic to detect if we're in a copy_to context.

Fixes #93117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants