Skip to content

Commit 0f0f33e

Browse files
committed
Fix OpenSearchVectorStoreIT
- Explicitly invoke OpenSearchVectorStore's afterPropertiesSet to make sure index mapping is completed. Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
1 parent 3618524 commit 0f0f33e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

vector-stores/spring-ai-opensearch-store/src/test/java/org/springframework/ai/vectorstore/opensearch/OpenSearchVectorStoreIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,9 @@ void testManageDocumentIdsSetting(boolean manageDocumentIds) {
825825
.initializeSchema(true)
826826
.build();
827827

828+
// Ensure the index is fully initialized before adding documents
829+
testVectorStore.afterPropertiesSet();
830+
828831
// Test documents
829832
List<Document> testDocuments = List.of(new Document("doc1", "Test content 1", Map.of("key1", "value1")),
830833
new Document("doc2", "Test content 2", Map.of("key2", "value2")));
@@ -870,6 +873,9 @@ void testManageDocumentIdsFalseForAWSOpenSearchServerless() {
870873
.initializeSchema(true)
871874
.build();
872875

876+
// Ensure the index is fully initialized before adding documents
877+
awsCompatibleVectorStore.afterPropertiesSet();
878+
873879
// Test documents with IDs (these should be ignored when
874880
// manageDocumentIds=false)
875881
List<Document> testDocuments = List.of(
@@ -917,6 +923,9 @@ void testManageDocumentIdsTrueWithExplicitIds() {
917923
.initializeSchema(true)
918924
.build();
919925

926+
// Ensure the index is fully initialized before adding documents
927+
explicitIdVectorStore.afterPropertiesSet();
928+
920929
// Test documents with specific IDs
921930
List<Document> testDocuments = List.of(
922931
new Document("explicit-id-1", "Explicit ID content 1", Map.of("type", "explicit")),

0 commit comments

Comments
 (0)