-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Search can fail when size is 0 and long sort optimization enabled. #56923
Comments
Pinging @elastic/es-search (:Search/Search) |
It looks to me like the error is coming from: https://github.com/elastic/elasticsearch/blob/v7.7.0/server/src/main/java/org/elasticsearch/search/query/QueryPhase.java#L376 |
@toby-jn thanks for raising this bug. From digging into the stack trace, it looks like this happens when (1) the search size is 0, and (2) the 'long sort' optimization is enabled. We added the optimization in 7.6 to speed up searches that sort on a We will look into a fix. In the meantime, a workaround would be to remove the |
Just managed to reproduce it, but looks like you beat me to why it wasn't working before, needed to add more documents for testing. Now able to reliably reproduce this with the following script on a fresh 7.7.0 install:
|
Sort optimization creates TopFieldCollector that errors when size=0. This ensures that sort optimization is not run when size=0. Closes elastic#56923
Sort optimization creates TopFieldCollector that errors when size=0. This ensures that sort optimization is not run when size=0. Closes #56923
Sort optimization creates TopFieldCollector that errors when size=0. This ensures that sort optimization is not run when size=0. Closes #56923
Sort optimization creates TopFieldCollector that errors when size=0. This ensures that sort optimization is not run when size=0. Closes #56923
Sort optimization creates TopFieldCollector that errors when size=0. This ensures that sort optimization is not run when size=0. Closes #56923
Elasticsearch version (
bin/elasticsearch --version
):Plugins installed: []
JVM version (
java -version
):OS version (
uname -a
if on a Unix-like system):Description of the problem including expected versus actual behavior:
After upgrading to 7.7.0 from 7.5.1, when doing a search with track_total_hits=true, size=0 and sort I get an error:
The index settings have:
If I set size to 1 or change the sort parameter to match the index sort then the query works. Both these queries work:
I've tried to create a minimal reproducible setup for this error, but using the same mappings and query I've not been able to trigger the error.
Logs:
Query run with error trace:
The text was updated successfully, but these errors were encountered: