-
Notifications
You must be signed in to change notification settings - Fork 140
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
Fix setting rescore as false in on_disk knn_vector query #2399
Fix setting rescore as false in on_disk knn_vector query #2399
Conversation
src/main/java/org/opensearch/knn/index/query/parser/KNNQueryBuilderParser.java
Show resolved
Hide resolved
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.
Thanks @e-emoto. Lets add a test somewhere in https://github.com/opensearch-project/k-NN/tree/main/src/test/java/org/opensearch/knn/integ that confirms that it actually does end up disabling re-scoring. Confirm that it fails before and works after.
These tests would provide a good template: https://github.com/opensearch-project/k-NN/blob/main/src/test/java/org/opensearch/knn/integ/ModeAndCompressionIT.java
src/main/java/org/opensearch/knn/index/query/rescore/RescoreContext.java
Outdated
Show resolved
Hide resolved
|
||
// Rescore context to be used when rescoring should be explicitly disabled | ||
public static final RescoreContext EXPLICITLY_DISABLED_RESCORE_CONTEXT = RescoreContext.builder() | ||
.oversampleFactor(DEFAULT_OVERSAMPLE_FACTOR) |
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.
nit: Do we need to specify this?
src/main/java/org/opensearch/knn/index/query/parser/KNNQueryBuilderParser.java
Show resolved
Hide resolved
Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]>
Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]>
Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]>
Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]>
9487cf4
to
63c778c
Compare
* Fix setting rescore as false in on_disk knn_vector query Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Update CHANGELOG.md Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Reapply Spotless Java Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Add IT for testing rescore enabled and disabled Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> --------- Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> (cherry picked from commit 387344e)
…project#2399) * Fix setting rescore as false in on_disk knn_vector query Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Update CHANGELOG.md Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Reapply Spotless Java Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Add IT for testing rescore enabled and disabled Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> --------- Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> (cherry picked from commit 387344e)
…project#2399) * Fix setting rescore as false in on_disk knn_vector query Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Update CHANGELOG.md Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Reapply Spotless Java Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Add IT for testing rescore enabled and disabled Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> --------- Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> (cherry picked from commit 387344e)
…project#2399) * Fix setting rescore as false in on_disk knn_vector query Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Update CHANGELOG.md Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Reapply Spotless Java Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> * Add IT for testing rescore enabled and disabled Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> --------- Signed-off-by: Ethan Emoto <[email protected]> Signed-off-by: Ethan Emoto <[email protected]> (cherry picked from commit 387344e) Signed-off-by: Ethan Emoto <[email protected]>
Description
This change adds a flag to RescoreContext for tracking if rescore has been disabled by the KNN query parameters. This flag is set to not skip rescore by default, and is only set to skip rescore if
"rescore": false
is in the KNN query. UTs were added for the KNNQueryBuilderParser that covers the different cases for rescore. The below steps were also run with a debugging cluster to verify that the rescore was being run/skipped correctly based on the query parameters.Manual Testing Steps
rescore skipped:
rescore does happen:
rescore does happen:
Related Issues
Resolves #2360
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.