Bug description The pgvector index is created at each application startup if the spring.ai.vectorstore.pgvector.index-type property is other than NONE. There should be a check that prevents creation if the index is already present.

Environment Spring AI version: 1.0.3 Java version: 17 Vector store: pgvector

Application properties configuration:

  ai:
    vectorstore:
      pgvector:
        index-type: HNSW
        distance-type: COSINE_DISTANCE

Steps to reproduce Start application and check the pgvector indexes. A new index is created at each restart. See attached figure.

Expected behavior If the index already exists, it does not need to be created

PgVectorIndex

Comment From: markpollack

We have introduced the configuration property initialize-schema whose default is false. Before this change the default was true and probably lead to this issue. Closing the issue as it seems to be fixed. Please reopen if you encounter any issues.