Achaius
Achaius

Reputation: 6124

How to update Index settings after index creation in spring-data-elasticsearch

I am writting spring-boot application using spring-data-elasticsearch. I have an entity class which automatically creates index in elasticsearch. But I want to define and set an analyzer to a field.

I am expecting something like callback to support this. Now index is getting created using the @Document

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

Upvotes: 0

Views: 1886

Answers (1)

Abacus
Abacus

Reputation: 19421

You can either disable automatic index creation, and do the index creation by yourself using the IndexOperations.create(Document settings) method. The Document.

Or you provide the settings in a json file on the classpath and refer to it with the @Setting annotation. As a reference check this test code

Upvotes: 1

Related Questions