Elasticsearch: Turn off index replicas

If you’re playing with elasticsearch on a single host you may notice your cluster health is always yellow. This is probably because your indexes are set to have one replica but there’s no other node to replicate it to.

To confirm if this is the case or not you can look in elasticsearch-head. In the Overview tab you should see a bunch of index shards marked as “Unassigned”. If your cluster health is 50% of the total then you probably have the setup of 1 shard and 1 replica per index. To make the status green change replicas to zero…

curl -XPUT http://127.0.0.1:9200/_settings -d '
{
    "index" : {
        "number_of_replicas" : 0
    }
}
'

Please note this will affect all indexes. Do not execute this on a production cluster and be sure to back up any data you don’t want to lose.


One Comment

  1. […] more: youdidwhatwithtsql.com » Blog Archive » Elasticsearch: Turn off index replicas […]

Leave a Reply