spring-projects / spring-projects/spring-ai
Support opt-in scalar metadata fields in MilvusVectorStore
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 5
Description
Expected Behavior
MilvusVectorStore should allow selected metadata keys to be stored in dedicated Milvus scalar fields.
The JSON field should continue to contain all document metadata.
For example:
MilvusVectorStore vectorStore = MilvusVectorStore.builder(milvusClient, embeddingModel)
.metadataFields(
MilvusVectorStore.MetadataField.int64("year"),
MilvusVectorStore.MetadataField.text("category"))
.initializeSchema(true)
.build();
When Spring AI creates a collection, it should add each configured metadata key as a nullable scalar field.
On insert, configured values should be stored in those fields.
Filter expressions should reference configured keys by their scalar field names.
Metadata keys that are not configured as scalar fields should continue to be referenced through the JSON metadata field.
If no scalar metadata fields are configured, existing behavior should remain unchanged.
Current Behavior
Currently, MilvusVectorStore stores all document metadata in a JSON field.
Filter expressions therefore reference metadata through JSON paths such as metadata["year"].
MilvusVectorStore does not provide an option to store selected metadata keys as scalar fields and filter on those fields.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at MilvusVectorStore and trace collection schema creation, document insertion, and filter-expression handling. Done means configured metadata keys are nullable scalar fields populated on insert and used directly in filters, while unconfigured keys and the no-configuration path retain JSON-field behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100