-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Mixing field collapsing and suggestions can lead to errors #70328
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
Labels
>bug
:Search/Search
Search-related issues that do not fall into other categories
Team:Search
Meta label for search team
v7.11.0
v8.0.0-alpha1
Comments
Pinging @elastic/es-search (Team:Search) |
cbuescher
pushed a commit
to cbuescher/elasticsearch
that referenced
this issue
Mar 15, 2021
Under certain circumstances we can get "array_index_out_of_bounds" exceptions in the fetch phase when merging comletion suggestion results with additonal field collapsing in place. We store the ScoreDoc array in the SortedTopDocs score docs contain both regular search hits and completion suggestion results added in SearchPhaseController#sortDocs, so when merging these we need to know the correct array offset where the completion results begin. This is based on the hits length calculated in SearchPhaseController#getHits, which doesn't take into account that there might be suggestion results present when calculating the number of hits. This change adds the number of suggestions to SortedTopDocs in order to be able to later account for it when calculating the hits. Closes elastic#70328
cbuescher
pushed a commit
that referenced
this issue
Mar 22, 2021
Under certain circumstances we can get "array_index_out_of_bounds" exceptions in the fetch phase when merging comletion suggestion results with additonal field collapsing in place. We store the ScoreDoc array in the SortedTopDocs score docs contain both regular search hits and completion suggestion results added in SearchPhaseController#sortDocs, so when merging these we need to know the correct array offset where the completion results begin. This is based on the hits length calculated in SearchPhaseController#getHits, which doesn't take into account that there might be suggestion results present when calculating the number of hits. This change adds the number of suggestions to SortedTopDocs in order to be able to later account for it when calculating the hits. Closes #70328
cbuescher
pushed a commit
to cbuescher/elasticsearch
that referenced
this issue
Mar 22, 2021
Under certain circumstances we can get "array_index_out_of_bounds" exceptions in the fetch phase when merging comletion suggestion results with additonal field collapsing in place. We store the ScoreDoc array in the SortedTopDocs score docs contain both regular search hits and completion suggestion results added in SearchPhaseController#sortDocs, so when merging these we need to know the correct array offset where the completion results begin. This is based on the hits length calculated in SearchPhaseController#getHits, which doesn't take into account that there might be suggestion results present when calculating the number of hits. This change adds the number of suggestions to SortedTopDocs in order to be able to later account for it when calculating the hits. Closes elastic#70328
cbuescher
pushed a commit
to cbuescher/elasticsearch
that referenced
this issue
Mar 22, 2021
Under certain circumstances we can get "array_index_out_of_bounds" exceptions in the fetch phase when merging comletion suggestion results with additonal field collapsing in place. We store the ScoreDoc array in the SortedTopDocs score docs contain both regular search hits and completion suggestion results added in SearchPhaseController#sortDocs, so when merging these we need to know the correct array offset where the completion results begin. This is based on the hits length calculated in SearchPhaseController#getHits, which doesn't take into account that there might be suggestion results present when calculating the number of hits. This change adds the number of suggestions to SortedTopDocs in order to be able to later account for it when calculating the hits. Closes elastic#70328
cbuescher
pushed a commit
that referenced
this issue
Mar 22, 2021
Under certain circumstances we can get "array_index_out_of_bounds" exceptions in the fetch phase when merging comletion suggestion results with additonal field collapsing in place. We store the ScoreDoc array in the SortedTopDocs score docs contain both regular search hits and completion suggestion results added in SearchPhaseController#sortDocs, so when merging these we need to know the correct array offset where the completion results begin. This is based on the hits length calculated in SearchPhaseController#getHits, which doesn't take into account that there might be suggestion results present when calculating the number of hits. This change adds the number of suggestions to SortedTopDocs in order to be able to later account for it when calculating the hits. Closes #70328
cbuescher
pushed a commit
that referenced
this issue
Mar 22, 2021
Under certain circumstances we can get "array_index_out_of_bounds" exceptions in the fetch phase when merging comletion suggestion results with additonal field collapsing in place. We store the ScoreDoc array in the SortedTopDocs score docs contain both regular search hits and completion suggestion results added in SearchPhaseController#sortDocs, so when merging these we need to know the correct array offset where the completion results begin. This is based on the hits length calculated in SearchPhaseController#getHits, which doesn't take into account that there might be suggestion results present when calculating the number of hits. This change adds the number of suggestions to SortedTopDocs in order to be able to later account for it when calculating the hits. Closes #70328
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
v7.11.0
v8.0.0-alpha1
There seem to be certain circumstances when requesting completion suggestions along with a regular search that uses the "collapse" feature can lead to "array_index_out_of_bounds_exception" in the fetch phase.
I was able to reproduce the issue on master and 7.11 with the following script:
The request returns
My guess is this only happens with at least 2 shards, but I might be mistaken. When I omitted the document ids, reproduction sometimes worked, sometimes failed, so I assume the distribution of documents on the shards also matters.
Stack trace of the exception is coming from
SearchPhaseController.merge
where we are exceeding the array bounds:The text was updated successfully, but these errors were encountered: