Change number of replicas on Elasticsearch

For small projects or testing you might run Elasticsearch only with one node and don’t need replicas.

vi changeDefaultReplicas.json

{
  "index_patterns": ["*"],
  "settings": {
    "index": {
      "number_of_replicas": 0
    }
  }
}
curl -XPUT ELASTICSEARCHIP:9200/_template/default_template  -H "Content-Type: application/json" -d @changeDefaultReplicas.json

vi updateReplicas.json

{ 
  "index" : { 
    "number_of_replicas" : 0 
  }
}
curl -XPUT ELASTICSEARCHIP:9200/_settings -H "Content-Type: application/json" -d @updateReplicas.json

https://curl.haxx.se/docs/manpage.html#-d

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.