-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Don't count hits via the collector if the hit count can be computed from index stats. #33701
Don't count hits via the collector if the hit count can be computed from index stats. #33701
Conversation
…rom index stats. This is something that we were already doing when sorting by field, which is now also done when sorting by score. As-is this change will speed up top-k `term` queries. This could work for `match_all` queries as well when we implement the `setMinCompetitiveScore` API on their Scorer.
Pinging @elastic/es-search-aggs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment regarding bwc issue with top docs serialization. LGTM otherwise.
topDocsSupplier = new CachedSupplier<>(topDocsCollector::topDocs); | ||
if (hitCount == -1) { | ||
assert trackTotalHits == false; | ||
totalHitsSupplier = () -> new TotalHits(topDocsSupplier.get().scoreDocs.length, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's return new TotalHits(0, TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO)
for now ? It is translated to -1
by the coordinating node anyway since track_total_hits
is false
in this case. We also need to handle bwc for mixed search with 6x node. Currently we have an exception if the hit count is greater than 0 and not an exact count so I suspect that this change could break some bwc tests randomly. We can revise this when we add the support for track_total_hits
as a number ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Will do.
Thanks @jimczi |
* master: (24 commits) Only notify ready global checkpoint listeners (elastic#33690) Don't count hits via the collector if the hit count can be computed from index stats. (elastic#33701) Expose retries for CCR fetch failures (elastic#33694) Test fix - Graph vertices could appear in different orders based on map insertion sequence (elastic#33709) Structured audit logging (elastic#31931) Core: Add DateFormatter interface for java time parsing (elastic#33467) [CCR] Check whether the rejected execution exception has the shutdown flag set (elastic#33703) Mute ClusterDisruptionIT#testSendingShardFailure Revert "Mute FullClusterRestartSettingsUpgradeIT" Adjust BWC version on settings upgrade test (elastic#33650) [ML] Allow overrides for some file structure detection decisions (elastic#33630) Adapt skip version for doc_values format deprecation [TEST] wait for no initializing shards [Docs] Minor fix in `has_child` javadoc comment (elastic#33674) Mute FullClusterRestartSettingsUpgradeIT [Kerberos] Add realm name & UPN to user metadata (elastic#33338) [TESTS] Disable specific locales for RestrictedTrustManagerTest (elastic#33299) SQL: Return functions in JDBC driver metadata (elastic#33672) SCRIPTING: Move terms_set Context to its Own Class (elastic#33602) AwaitsFix testRestoreMinmal ...
This is something that we were already doing when sorting by field, which is
now also done when sorting by score. As-is this change will speed up top-k
term
queries. This could work formatch_all
queries as well when weimplement the
setMinCompetitiveScore
API on their Scorer.