Spring Data Elasticsearch uses this information when creating the index; it it not reapplied to change parameters like the numner of shards. So what you want to do is not possible with Spring Data Elasticsearch.
If you can afford to drop the data and have a possibility to reload it, then delete the index, restart your program with the changed @Document
annotation and reload the data.
If you cannot simply reload the data, you can do the following directly in Elasticsearch (for the exact commands please refer to the Elasticsearch docs):
- create a new index with the shard settings you want to have and name it for example index-new
- reindex your old index to the new index
- if you can live with the new index name, change your
@Document
annotation to use the new index.
- if not, drop the old index and create it anew with the old name and the new settings, and the reindex from index-new to the index with the new name