To shrink a shard in elasticsearch we already have a “/old_index/_shrink/new_index” endpoint , which creates a new index with less shards. An example of endpoint request : after this execution you would have two indexes with same number of documents and mappings but with different shards and replicas. Sometimes problem occurs like: Then first run the below request: Verify the documents in new_index , and when you are sure its ok then you can delete the old index by requesting: Github: https://github.com/bazingarj/elasticsearch-shrink-index-shards/tree/master Written by