Elasticsearch 5.x update dynamic settings

Hi All,
we have installed on our development environment the x-pack plugin but our cluster actually is in yellow state because we have only 1 node and there are some replicas/shards unassigned. We tried to fix this configuration modifying the indexes settings but we received an error when we applied the action to the open indices.

We closed all the indices but we can't update the settings for the closed indices.

is there a procedure to change the shards and replicas number on the entire cluster items?

Thanks,
Marcello

@Marcello_A Please don't make us guess what you did, show us instead. And provide the exceptions you saw.

is there a procedure to change the shards and replicas number on the entire cluster items?

You can't change the number of primary shards on an existing index.

To change the number of replicas on all indices, you can do the following on an open index:

POST */_settings
{
  "number_of_replicas": 1
}

After some tests we tried the reindex function to change the configuration with the new shards and replicas number. Could it be a fine approach?

curl -XPUT 'http://dev-elk01:9200/.kibana_new' -d'{
  "settings": {
    "number_of_shards": "1",
	"number_of_replicas" : "0"
  }
}'


curl -XPOST 'http://dev-elk01:9200/_reindex' -H 'Content-Type: application/json' -d'
{
  "source": {
    "index": ".kibana"
  },
  "dest": {
    "index": ".kibana_new"
  }
}
'

curl -XDELETE "http://dev-elk01:9200/.kibana" 
 
curl -XPUT 'http://dev-elk01.fineco.it:9200/.kibana' -d'{
  "settings": {
    "number_of_shards": "1",
	"number_of_replicas" : "0"
  }
}'

 
curl -XPOST 'http://dev-elk01:9200/_reindex' -H 'Content-Type: application/json' -d'
{
  "source": {
    "index": ".kibana_new"
  },
  "dest": {
    "index": ".kibana"
  }
}'

curl -XDELETE "http://dev-elk01:9200/.kibana_new"

Yes, that's a good approach, although instead of reindexing it twice, you could just create an alias called .kibana and point that at .kibana_new

Thanks for the tip related to alias creation. Could i create a default template to catch the pattern "*" and apply the number of shards and replicas with a default value? In this case i can override the default configuration with another template.

Thanks,
marcello

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.