-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Add the ability to set the number of hits to track accurately #35291
Closed
Conversation
This file contains 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
In Lucene 8 searches can skip non-competitive hits if the total hit count is not requested. It is also possible to track the number of hits up to a certain threshold. This is a trade off to speed up searches while still being able to know a lower bound of the total hit count. This change adds the ability to set this threshold directly in the `track_total_hits` search option. A boolean value (`true`, `false`) indicates whether the total hit count should be tracked in the response. When set as an integer this option allows to compute a lower bound of the total hits while preserving the ability to skip non-competitive hits when enough hits have been collected. In order to ensure that the result is correctly interpreted this commit also adds a new section in the search response that indicates the number of tracked hits and whether the value is a lower bound (`gte`) or the exact count (`eq`): ``` GET /_search { "track_total_hits": 100, "query": { "term": { "title": "fast" } } } ``` ... will return: ``` { "_shards": ... "hits" : { "total" : -1, "tracked_total": { "value": 100, "relation": "gte" }, "max_score" : 0.42, "hits" : [] } } ``` Relates elastic#33028
jimczi
added
>feature
:Search/Search
Search-related issues that do not fall into other categories
v7.0.0
labels
Nov 6, 2018
Pinging @elastic/es-search-aggs |
We've decided to take another route. Closing for now and I'll revisit in another pr. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
In Lucene 8 searches can skip non-competitive hits if the total hit count is not requested.
It is also possible to track the number of hits up to a certain threshold. This is a trade off to speed up searches while still being able to know a lower bound of the total hit count. This change adds the ability to set this threshold directly in the
track_total_hits
search option. A boolean value (true
,false
) indicates whether the total hit count should be tracked in the response. When set as an integer this option allows to compute a lower bound of the total hits while preserving the ability to skip non-competitive hits when enough matches have been collected.In order to ensure that the result is correctly interpreted this commit also adds a new section in the search response that indicates the number of tracked hits and whether the value is a lower bound (gte
) or the exact count (eq
)Relates #33028