Add scalar metadata fields to Milvus#6594
Open
ultramancode wants to merge 1 commit into
Open
Conversation
Signed-off-by: Taewoong Kim <ktw2172@gmail.com>
443b0ad to
f9ac7ec
Compare
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.
Closes #6593
MilvusVectorStorecurrently stores all document metadata in a JSON field.Filter expressions therefore reference metadata through JSON paths.
This PR adds an opt-in
metadataFields(...)builder option for storing selected metadata keys as Milvus scalar fields.When Spring AI creates a collection, configured metadata keys are added as nullable scalar fields.
The supported metadata field types are
Bool,Int8,Int16,Int32,Int64,Float,Double, andVarChar.The remaining Milvus scalar field types (
Array,JSON,Geometry, andTimestamptz) require type-specific handling and are intentionally left for follow-up work.On insert, configured metadata values are also stored in those fields, while all metadata remains in the JSON field.
Spring AI filter expressions reference configured keys by their scalar field names.
Metadata keys that are not configured as scalar fields continue to use the JSON metadata field.
If no scalar metadata fields are configured, existing behavior is unchanged.
Verified collection creation, insertion, and filtering for the eight currently supported field types, as well as missing configured values and mixed scalar/JSON filtering, against
milvusdb/milvus:v2.6.18.