Skip to content

Commit d4b6cf2

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 d82eec3 commit d4b6cf2

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
@@ -823,6 +823,9 @@ void testManageDocumentIdsSetting(boolean manageDocumentIds) {
823823
.initializeSchema(true)
824824
.build();
825825

826+
// Ensure the index is fully initialized before adding documents
827+
testVectorStore.afterPropertiesSet();
828+
826829
// Test documents
827830
List<Document> testDocuments = List.of(new Document("doc1", "Test content 1", Map.of("key1", "value1")),
828831
new Document("doc2", "Test content 2", Map.of("key2", "value2")));
@@ -868,6 +871,9 @@ void testManageDocumentIdsFalseForAWSOpenSearchServerless() {
868871
.initializeSchema(true)
869872
.build();
870873

874+
// Ensure the index is fully initialized before adding documents
875+
awsCompatibleVectorStore.afterPropertiesSet();
876+
871877
// Test documents with IDs (these should be ignored when
872878
// manageDocumentIds=false)
873879
List<Document> testDocuments = List.of(
@@ -915,6 +921,9 @@ void testManageDocumentIdsTrueWithExplicitIds() {
915921
.initializeSchema(true)
916922
.build();
917923

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

0 commit comments

Comments
 (0)