I'd like to separate the process of creating the index (including settings and mapping) from the rest of the application to have more control over the behaviour of my application. My spring boot project creates the index automatically on startup. Is there a way to disable the automatic index creation process?
Asked
Active
Viewed 5,969 times
7
-
I don't know if this is possible on top of my head but this may help you, since I don't think it's in the documentation: an index for a `@Document` is created as soon as the repository for that document is created. – Aerus Jul 13 '17 at 07:58
1 Answers
8
@Document annotation has createIndex property which is by default set to true. Just set it to:
@Document(indexName = "products", createIndex = false)

Joanna Mamczynska
- 2,148
- 16
- 14
-
1In which version such field present? Looks like it is obsolete and is absent in last versions. – Oleksandr Yefymov Mar 01 '18 at 15:11
-
1At the moment of your question, the current version of Spring Data Elasticsearch is 3.0.4 and I still see that it is present in the [API](https://docs.spring.io/spring-data/elasticsearch/docs/3.0.4.RELEASE/api/org/springframework/data/elasticsearch/annotations/Document.html) (also 3.1.0.M1 has createIndex). – Joanna Mamczynska Mar 01 '18 at 15:26
-
1