Skip to content

Commit 3d73a51

Browse files
authored
Tiny refactor for code cleanup
Signed-off-by: stroller <[email protected]>
1 parent 9949c8b commit 3d73a51

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

vector-stores/spring-ai-elasticsearch-store/src/main/java/org/springframework/ai/vectorstore/elasticsearch/ElasticsearchVectorStore.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,13 @@ private DenseVectorSimilarity parseSimilarity(String similarity) {
335335
public void afterPropertiesSet() {
336336
// For the index to be present, either it must be pre-created or set the
337337
// initializeSchema to true.
338-
if (!this.initializeSchema) {
339-
boolean exists = indexExists();
340-
if(!exists){
341-
throw new IllegalArgumentException("Index not found");
342-
}
338+
if (indexExists()) {
343339
return;
344340
}
345-
if (!indexExists()) {
346-
createIndexMapping();
341+
if (!this.initializeSchema) {
342+
throw new IllegalArgumentException("Index not found");
347343
}
344+
createIndexMapping();
348345
}
349346

350347
@Override

0 commit comments

Comments
 (0)