-
Notifications
You must be signed in to change notification settings - Fork 144
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
Changes NativeEngineKNNQuery to execute search and rescore in createWeight phase #2014
Changes NativeEngineKNNQuery to execute search and rescore in createWeight phase #2014
Conversation
590472d
to
d49e840
Compare
@@ -96,7 +95,7 @@ public static Query create(CreateQueryRequest createQueryRequest) { | |||
.rescoreContext(rescoreContext) | |||
.build(); | |||
} | |||
return isKnnQueryRewriteEnabled() ? new NativeEngineKnnVectorQuery(knnQuery) : knnQuery; | |||
return createQueryRequest.getRescoreContext().isPresent() ? new NativeEngineKnnVectorQuery(knnQuery) : knnQuery; |
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.
@jmazanec15 Please verify this condition is correct
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.
yeah this looks good
d49e840
to
01be393
Compare
createWeight phase rewrite is executed in QueryPhase and FetchPhase in opensearch, this increases the query latency. As an alternative, the search logic is moved to createWeight phase. This will only be used when there is a rescore context present, as a result this will only execute when the mode is set to on-disk Signed-off-by: Tejas Shah <shatejas@amazon.com>
01be393
to
c34c277
Compare
@@ -39,8 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
* Refactor method structure and definitions [#1920](https://github.com/opensearch-project/k-NN/pull/1920) | |||
* Refactor KNNVectorFieldType from KNNVectorFieldMapper to a separate class for better readability. [#1931](https://github.com/opensearch-project/k-NN/pull/1931) | |||
* Generalize lib interface to return context objects [#1925](https://github.com/opensearch-project/k-NN/pull/1925) | |||
* Move k search k-NN query to re-write phase of vector search query for Native Engines [#1877](https://github.com/opensearch-project/k-NN/pull/1877) |
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.
Removing this, the change is now covered in the log above
k-NN query rescore support for native engines [#1984](https://github.com/opensearch-project/k-NN/pull/1984)
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.
LGTM
9dbe7de
into
opensearch-project:main
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-2014-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 9dbe7de078616da9d95c27883c468c4ef4b7df4a
# Push it to GitHub
git push --set-upstream origin backport/backport-2014-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
@shatejas backport to 2.x failed. Can you fix it and raise a PR. Thanks! |
…arch-project#2014) createWeight phase rewrite is executed in QueryPhase and FetchPhase in opensearch, this increases the query latency. As an alternative, the search logic is moved to createWeight phase. This will only be used when there is a rescore context present, as a result this will only execute when the mode is set to on-disk Signed-off-by: Tejas Shah <shatejas@amazon.com> (cherry picked from commit 9dbe7de)
…arch-project#2014) createWeight phase rewrite is executed in QueryPhase and FetchPhase in opensearch, this increases the query latency. As an alternative, the search logic is moved to createWeight phase. This will only be used when there is a rescore context present, as a result this will only execute when the mode is set to on-disk Signed-off-by: Tejas Shah <shatejas@amazon.com> Signed-off-by: Akash Shankaran <akash.shankaran@intel.com>
rewrite is executed in QueryPhase and FetchPhase in opensearch, this increases the query latency. As an alternative, the search logic is moved to createWeight phase. This will only be used when there is a rescore context present, as a result this will only execute when the mode is set to on-disk
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.