ES|QL: Pass fix size instead of maxPageSize to LuceneTopNOperator scorer#135767
Merged
ioanatia merged 5 commits intoelastic:mainfrom Oct 2, 2025
Merged
ES|QL: Pass fix size instead of maxPageSize to LuceneTopNOperator scorer#135767ioanatia merged 5 commits intoelastic:mainfrom
ioanatia merged 5 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
nik9000
reviewed
Oct 2, 2025
| } | ||
| var leafCollector = perShardCollector.getLeafCollector(scorer.leafReaderContext()); | ||
| scorer.scoreNextRange(leafCollector, scorer.leafReaderContext().reader().getLiveDocs(), maxPageSize); | ||
| scorer.scoreNextRange(leafCollector, scorer.leafReaderContext().reader().getLiveDocs(), NUM_DOCS_INTERVAL); |
Member
There was a problem hiding this comment.
Do we need to lock this to the max of the range?
It looks like CancellableBulkScorer makes this bigger and bigger with time. But I think this is good and we can get it in and iterate.
Contributor
Author
There was a problem hiding this comment.
We do something similar here, at least we try to avoid overflows:
kderusso
approved these changes
Oct 2, 2025
Member
kderusso
left a comment
There was a problem hiding this comment.
LGTM, but consider labeling with >bug and creating a release note entry as this would be impacting serverless performance?
Collaborator
|
Hi @ioanatia, I've created a changelog YAML for you. |
nik9000
approved these changes
Oct 2, 2025
| } | ||
| var leafCollector = perShardCollector.getLeafCollector(scorer.leafReaderContext()); | ||
| scorer.scoreNextRange(leafCollector, scorer.leafReaderContext().reader().getLiveDocs(), maxPageSize); | ||
| scorer.scoreNextRange(leafCollector, scorer.leafReaderContext().reader().getLiveDocs(), NUM_DOCS_INTERVAL); |
ioanatia
added a commit
to ioanatia/elasticsearch
that referenced
this pull request
Oct 2, 2025
Collaborator
💚 Backport successful
|
elasticsearchmachine
pushed a commit
that referenced
this pull request
Oct 3, 2025
ioanatia
added a commit
to ioanatia/elasticsearch
that referenced
this pull request
Oct 8, 2025
ioanatia
added a commit
that referenced
this pull request
Oct 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Initially we passed
scorer.leafReaderContext().reader().maxDoc()to the bulk scorer, which showed great improvements.However this will also keep the current thread busy until it is able to score all the docs from the current reader.
There are ways we can improve this, but they would require more changes.
For now I wanted to push a quick fix to mitigate some of the regressions we see, with the
maxPageSizebecoming smaller after #108412 .We should still see a significant performance boost just by scoring docs in batches of 4096 docs, instead of
maxPageSize.