How To Increase Primary Shards Of A Indices In Elasticsearch?

How to increase primary shards of a Indices in Elasticsearch?

The incremental re-sharding is not allowed in Elasticsearch. So, to increase the number of primary shards from 1 to 2 is not possible.

However, there are two options to reach this goal,

  • Split the index to 4 using this API and then Shrink it to index with 2 primary shards using this API : Shrink Index API
or
  • Create a new index with two primary shards and re-index your data to this index using this API Reindex API. Create an index with two shards and re-index the data into that index. After that delete the first index. Also set alias for new index to work with name of the first index, as well.

ELK Docs To Create Index Indices - Create Index API .

Note : By Default 5 indices are obtained during the installation.