Implement support for weighted rrf#130658
Merged
mridula-s109 merged 54 commits intoelastic:mainfrom Jul 31, 2025
Merged
Conversation
mridula-s109
commented
Jul 15, 2025
x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java
Outdated
Show resolved
Hide resolved
mridula-s109
commented
Jul 15, 2025
x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java
Outdated
Show resolved
Hide resolved
7614936 to
e7f0a90
Compare
Contributor
f1eede5 to
f5e1572
Compare
f1eede5 to
0640099
Compare
ioanatia
reviewed
Jul 29, 2025
x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java
Outdated
Show resolved
Hide resolved
...ck/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverComponent.java
Outdated
Show resolved
Hide resolved
...ck/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverComponent.java
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@ioanatia have addressed all the comments. please let me know if there are any more concerns. |
ioanatia
reviewed
Jul 29, 2025
Contributor
ioanatia
left a comment
There was a problem hiding this comment.
this is getting super close! thank you for your patience 🙇♀️
...ck/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverComponent.java
Outdated
Show resolved
Hide resolved
...in/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/320_rrf_weighted_retriever.yml
Outdated
Show resolved
Hide resolved
...in/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/320_rrf_weighted_retriever.yml
Show resolved
Hide resolved
...ck/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverComponent.java
Show resolved
Hide resolved
leemthompo
reviewed
Jul 31, 2025
Co-authored-by: Liam Thompson <leemthompo@gmail.com>
Mikep86
approved these changes
Jul 31, 2025
...plugin/rank-rrf/src/test/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilderTests.java
Show resolved
Hide resolved
smalyshev
pushed a commit
to smalyshev/elasticsearch
that referenced
this pull request
Jul 31, 2025
* RRFRetrieverComponent added: * Modified parser, toXcontent and included component in the RetrieverBuilder * [CI] Auto commit changes from spotless * Resolved merge conflicts * Fixed compile issues in tests * [CI] Auto commit changes from spotless * trying to resolve parse errros * wip * Modified builder * [CI] Auto commit changes from spotless * Removed unnecessary code * Fixed import * Enhanced tests * Fixed the failing tests * Yaml tests were added * Added cluster features to it * Fixed spotless * Update docs/changelog/130658.yaml * Fixed the relaxed constraints * Resolving issues * Resolved PR comments * removed simplified rrf * changed the test file back to its original state * Resolved comments to have ahelper method and the test case to use it * made parsing robust * IT test reverted * Replaced the declareString array parser * Enforced weights as nonnull * Fixed the weights null * Empty weight shouldnt be serialised * [CI] Auto commit changes from spotless * removed the hard coding * Cleanup and optimised the code flow * Fixed the comments * [CI] Auto commit changes from spotless * optimised test * Added additional test * addressed the commentS * Update docs/changelog/130658.yaml Co-authored-by: Liam Thompson <leemthompo@gmail.com> * Explicit check for retriever object * Resolved PR comments * Fixed the error message --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Ioana Tagirta <ioana.tagirta@elastic.co> Co-authored-by: Liam Thompson <leemthompo@gmail.com>
This was referenced Oct 13, 2025
Member
|
Edit: nvm, the old syntax seems to be still valid. @mridula-s109 @leemthompo Hey folks. Just double checking here. Judging from the provided JSON example, this seems to be a breaking change since the structure now includes a new nesting: {
"retriever": {
"rrf": {
"retrievers": [
{ // <- Retriever container
"standard": {
"query": { "match": { "description": "pizza" } }
}
},to {
"retriever": {
"rrf": {
"retrievers": [
{ // <- New RRFRetrieverComponent class that wraps `retriever` and `weigth`
"retriever": {
"standard": {
"query": { "match": { "description": "pizza" } }
}
},
"weight": 0.7
},Is this expected to ship in a minor version? |
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.
Implement support for weighted RRF
Summary
This PR implements support for weighted RRF (Reciprocal Rank Fusion) retrievers, allowing users to specify custom weights for each sub-retriever within an RRF retriever configuration. This addresses a common customer request to customize the influence of different retrievers in the RRF scoring process.
Core Implementation
Key Features
1. Weighted Retriever Support
Users can now specify weights for individual retrievers:
{ "retriever": { "rrf": { "retrievers": [ { "retriever": { "standard": { "query": { "match": { "description": "pizza" } } } }, "weight": 0.7 }, { "retriever": { "knn": { "field": "vector", "query_vector": [1,2,3], "k": 10 } }, "weight": 0.3 } ] } } }