-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Docs: Add weight parameter documentation for Weighted RRF retriever #136698
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
Open
mridula-s109
wants to merge
13
commits into
elastic:main
Choose a base branch
from
mridula-s109:docs/add-weighted-rrf-documentation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+125
−19
Open
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
831862f
Added weighted rrf examples to the doc
mridula-s109 a497c09
Cleaned up doc
mridula-s109 ab87935
Modified information
mridula-s109 109123e
Merge branch 'main' into docs/add-weighted-rrf-documentation
mridula-s109 44ac582
Fixed discrepancies
mridula-s109 2956fd6
made it more explicit
mridula-s109 e22612e
Update docs/reference/elasticsearch/rest-apis/retrievers/retrievers-e…
mridula-s109 e68f6e1
Merge branch 'main' into docs/add-weighted-rrf-documentation
mridula-s109 95b37f1
Resolved PR comments
mridula-s109 40585fc
Resolved comments
mridula-s109 d7d4e2c
Merge branch 'main' into docs/add-weighted-rrf-documentation
mridula-s109 c03de1a
Resolved comments
mridula-s109 2ac294f
Update docs/reference/elasticsearch/rest-apis/retrievers/retrievers-e…
mridula-s109 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,7 +113,9 @@ First, let’s examine how to combine two different types of queries: a `kNN` qu | |
While these queries may produce scores in different ranges, we can use Reciprocal Rank Fusion (`rrf`) to combine the results and generate a merged final result list. | ||
|
||
To implement this in the retriever framework, we start with the top-level element: our `rrf` retriever. | ||
This retriever operates on top of two other retrievers: a `knn` retriever and a `standard` retriever. Our query structure would look like this: | ||
This retriever operates on top of two other retrievers: a `knn` retriever and a `standard` retriever. | ||
We can also specify weights to adjust the influence of each retriever on the final ranking. | ||
In this example, we're giving the semantic search (kNN) twice the influence of the lexical search: | ||
mridula-s109 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
```console | ||
GET /retrievers_example/_search | ||
|
@@ -122,26 +124,32 @@ GET /retrievers_example/_search | |
"rrf": { | ||
"retrievers": [ | ||
{ | ||
"standard": { | ||
"query": { | ||
"query_string": { | ||
"query": "(information retrieval) OR (artificial intelligence)", | ||
"default_field": "text" | ||
"retriever": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old syntax still works when not specifying weights, correct? Should we keep both examples in the docs? |
||
"standard": { | ||
"query": { | ||
"query_string": { | ||
"query": "(information retrieval) OR (artificial intelligence)", | ||
"default_field": "text" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"weight": 1.0 | ||
}, | ||
{ | ||
"knn": { | ||
"field": "vector", | ||
"query_vector": [ | ||
0.23, | ||
0.67, | ||
0.89 | ||
], | ||
"k": 3, | ||
"num_candidates": 5 | ||
} | ||
"retriever": { | ||
"knn": { | ||
"field": "vector", | ||
"query_vector": [ | ||
0.23, | ||
0.67, | ||
0.89 | ||
], | ||
"k": 3, | ||
"num_candidates": 5 | ||
} | ||
}, | ||
"weight": 2.0 | ||
} | ||
], | ||
"rank_window_size": 10, | ||
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.