-
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
Add stored fields for knn_vector type #1630
Conversation
@@ -109,8 +98,8 @@ private static KNNVectorFieldMapper toType(FieldMapper in) { | |||
public static class Builder extends ParametrizedFieldMapper.Builder { | |||
protected Boolean ignoreMalformed; | |||
|
|||
protected final Parameter<Boolean> stored = Parameter.boolParam("store", false, m -> toType(m).stored, false); | |||
protected final Parameter<Boolean> hasDocValues = Parameter.boolParam("doc_values", false, m -> toType(m).hasDocValues, true); | |||
protected final Parameter<Boolean> stored = Parameter.storeParam(m -> toType(m).stored, false); |
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.
changed these to use built ins to clean up the code.
@@ -735,11 +733,6 @@ Optional<float[]> getFloatsFromContext(ParseContext context, int dimension, Meth | |||
return Optional.of(array); | |||
} | |||
|
|||
@Override |
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.
Removed as it is default for ParametrizedFieldMapper
@luyuncheng could you take a look at this PR? |
src/main/java/org/opensearch/knn/index/mapper/LuceneFieldMapper.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/index/mapper/KNNVectorFieldMapperUtil.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/index/mapper/KNNVectorFieldMapperUtil.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/index/mapper/KNNVectorFieldMapperUtil.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/index/mapper/KNNVectorFieldMapperUtil.java
Outdated
Show resolved
Hide resolved
Fixes bug where we were not creating stored field type for knn_vector even when the mapping parameter is passed. Along with this, clean up the field mapper implementations. Add relevant uTs and iTs to ensure functionality is working as expected. Signed-off-by: John Mazanec <jmazane@amazon.com>
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-1630-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 699510d61dd8c583653118be172fb60a00463760
# Push it to GitHub
git push --set-upstream origin backport/backport-1630-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 |
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.13 2.13
# Navigate to the new working tree
cd .worktrees/backport-2.13
# Create a new branch
git switch --create backport/backport-1630-to-2.13
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 699510d61dd8c583653118be172fb60a00463760
# Push it to GitHub
git push --set-upstream origin backport/backport-1630-to-2.13
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.13 Then, create a pull request where the |
Fixes bug where we were not creating stored field type for knn_vector even when the mapping parameter is passed. Along with this, clean up the field mapper implementations. Add relevant uTs and iTs to ensure functionality is working as expected. Signed-off-by: John Mazanec <jmazane@amazon.com> (cherry picked from commit 699510d) Signed-off-by: John Mazanec <jmazane@amazon.com>
Description
Fixes bug where we were not creating stored field type for knn_vector even when the mapping parameter is passed. To do this, we create a stored field from the bytes of the vectors. Then, implemented
valueForDisplay
in order to ensure that the vectors are displayed properly.Example:
Along with this, clean up the field mapper implementations.
Add relevant uTs and iTs to ensure functionality is working as expected.
Issues Resolved
#1606
Check List
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.