Search code examples
elasticsearchrestoresharding

Settings for Elasticsearch readonly single node cluster


I have been asked to restore data for a 3 node ES cluster to a new read-only cluster. The new cluster is only for showing old log data and have very few request.

I have set up one server that will be my "cluster". When I run my restore command I get 5 shards and 5 unassigned shards and I think that this is redundant as one must be enough.

How can I restore my data so I use as little disk space as possible?


Solution

  • Your cluster must be yellow since there are unassigned shards. Simply run the following command to remove the unassigned replica shards and the cluster will turn green again:

    PUT index-name/_settings
    {
       "number_of_replicas": 0
    }
    

    Just note, though, that removing the unassigned replicas will not save you any disk space since those replica shards do not take up any space because they are unassigned anayway.