Upgrading versions or major structure changes in elasticsearch

Info taken from: https://www.elastic.co/guide/en/elasticsearch/reference/1.4/setup-upgrade.html#rolling-upgrades

Before making major changes on a cluster, stop internal shard reallocation:

curl -XPUT localhost:9200/_cluster/settings -d '{
    "transient" : {
        "cluster.routing.allocation.enable" : "none"
    }
}'

Shutdown a local node safely (only if you need to!)

curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'

Do what you need to do here like upgrade versions. You could change the number of replicas:

curl -XPUT 'localhost:9200/my_index/_settings' -d '
{
    "index" : {
        "number_of_replicas" : 2
    }
}'

 

Reenable reallocation when you're done. It may take some time to balance the shards again based on your changes. You can use /_cat/shards & /_cat/health to monitor whats happening

curl -XPUT localhost:9200/_cluster/settings -d '{
    "transient" : {
        "cluster.routing.allocation.enable" : "all"
    }
}'
Details
Updated: 13th March 2016

Play Blokr Now FREE!
blokr.io the web game where you can eat other blocks!