OpenSearch: Omit explicit document IDs when manageDocumentIds=false for AWS Serverless (issue - #3818) #4220
+413
−2
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.
OpenSearch: Document ID management for AWS OpenSearch Serverless (manageDocumentIds)
Summary
OpenSearchVectorStore#doAdd(List<Document>)
was updated to make document ID handling configurable. WhenmanageDocumentIds=false
, the index request omits the ID so that OpenSearch auto-generates it.Background
Changes
org.springframework.ai.vectorstore.opensearch.OpenSearchVectorStore
doAdd(List<Document> documents)
manageDocumentIds=true
(default): index with explicit IDs (backward-compatible)manageDocumentIds=false
: omit ID so that OpenSearch auto-generates itUsage
Testing
Unit tests
OpenSearchVectorStoreTest
manageDocumentIds=true
: BulkRequest contains explicit IDsmanageDocumentIds=false
: BulkRequest omits IDs (auto-generated)Run:
./mvnw -pl vector-stores/spring-ai-opensearch-store -Dtest=OpenSearchVectorStoreTest test
Integration tests
OpenSearchVectorStoreIT
OpenAiEmbeddingModel
manageDocumentIds=false
: indexing/search without explicit IDs (AWS Serverless compatible)manageDocumentIds=true
: explicit IDs and delete-by-IDRun:
./mvnw -pl vector-stores/spring-ai-opensearch-store -am -Dtest=OpenSearchVectorStoreIT test
Caveats and compatibility
manageDocumentIds=false
, OpenSearch auto-generates IDs. ID-based deletion may therefore be limited; prefer filter-based deletion in this mode.manageDocumentIds=true
.Related PR and Next Steps
I believe the failing integration tests in this PR are related to the schema and search path improvements being introduced in [PR #1121].
To move forward, I see two potential paths:
Please let me know which approach you prefer. I'm happy to proceed with either option to get this resolved.
Related issue