1

createIndex=true doesn't create the index mapping in Elasticsearch using spring-data-elasticsearch

@Document(indexName = "profiles", shards=1, versionType = VersionType.INTERNAL, createIndex = true)

1 Answer 1

2

Setting the parameter createIndex = true (which by the way is the default value) by itself does not do anything.

You need to have a Spring Data Elasticsearch repository with the entity class that has this annotation in your application, and the index must not yet exist.

The check if the index exists is done on repository bootstrapping and only if the index does not exist, it will be created and the mappings are written to the index.

Sign up to request clarification or add additional context in comments.

3 Comments

createIndex = true is set to true in @Document annotation, but the index is not getting created. How do I debug this?
do you have a Repository defined?
and looking at the logging in your other post: Does your Elasticsearch need some authentication or other configuration?, because you get response codes of 400 there

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.