- Notifications
You must be signed in to change notification settings - Fork 25.5k
Add a generic rescorer
retriever based on the search request's rescore functionality #118585
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
Merged
Conversation
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
…the original field
This commit introduces support for using the `_shard_doc` field as a sort tiebreaker during query rescoring. This change is a prerequisite to add support for rescorers in retriever workflows.
This change adds a new `rescorer` retriever that re-scores only the top documents returned by its child retriever.
leemthompo reviewed Dec 18, 2024
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
…o rescorer_retriever
Thank you for tackling this @jimczi ! I didn't fully review, but it looks nice! |
jimczi added a commit to jimczi/elasticsearch that referenced this pull request Dec 18, 2024
…ore functionality (elastic#118585) This pull request introduces a new retriever called `rescorer`, which leverages the `rescore` functionality of the search request. The `rescorer` retriever re-scores only the top documents retrieved by its child retriever, offering fine-tuned scoring capabilities. All rescorers supported in the `rescore` section of a search request are available in this retriever, and the same format is used to define the rescore configuration. <details> <summary>Example:</summary> ```yaml - do: search: index: test body: retriever: rescorer: rescore: window_size: 10 query: rescore_query: rank_feature: field: "features.second_stage" linear: { } query_weight: 0 retriever: standard: query: rank_feature: field: "features.first_stage" linear: { } size: 2 ``` </details> Closes elastic#118327 Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
elasticsearchmachine pushed a commit that referenced this pull request Dec 19, 2024
…s rescore functionality (#119023) * Add a generic `rescorer` retriever based on the search request's rescore functionality (#118585) This pull request introduces a new retriever called `rescorer`, which leverages the `rescore` functionality of the search request. The `rescorer` retriever re-scores only the top documents retrieved by its child retriever, offering fine-tuned scoring capabilities. All rescorers supported in the `rescore` section of a search request are available in this retriever, and the same format is used to define the rescore configuration. <details> <summary>Example:</summary> ```yaml - do: search: index: test body: retriever: rescorer: rescore: window_size: 10 query: rescore_query: rank_feature: field: "features.second_stage" linear: { } query_weight: 0 retriever: standard: query: rank_feature: field: "features.first_stage" linear: { } size: 2 ``` </details> Closes #118327 Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> * replace java21 only method * fix compil --------- Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport pending >feature :Search Relevance/Ranking Scoring, rescoring, rank evaluation. Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v8.18.0 v9.0.0
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.
This pull request introduces a new retriever called
rescorer
, which leverages therescore
functionality of the search request.The
rescorer
retriever re-scores only the top documents retrieved by its child retriever, offering fine-tuned scoring capabilities.All rescorers supported in the
rescore
section of a search request are available in this retriever, and the same format is used to define the rescore configuration.Example:
Key Changes
The original rescore phase was modified to support tie-breaking on the
_shard_doc
field. This ensures consistent sorting across all rounds of rescoring.CompoundRetrieverBuilder
Integration:The implementation uses the
CompoundRetrieverBuilder
, ensuring therescorer
retriever can seamlessly integrate into any position within the retriever tree.Commit Structure
_shard_doc
as a tiebreaker.rescorer
retriever.To facilitate review, I split the changes into two commits. If preferred, I can open separate pull requests for each commit to simplify the review process. However, I opted to include all changes in this PR to provide a complete overview.
Closes #118327