Change number_of_replicas to 0 on existing indices

I am trying to set number_of_replicas to 0 in all indices with:

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

but after that it doesnt change any index number_of_replicas to 0 and still are 1

get _settings
....
".monitoring-alerts-6": {
"settings": {
"index": {
"codec": "best_compression",
"number_of_shards": "1",
"auto_expand_replicas": "0-1",
"provided_name": ".monitoring-alerts-6",
"format": "6",
"creation_date": "1532476832797",
"number_of_replicas": "1",
"uuid": "cuwbWN9aRa6BC_83qx2ffw",
"version": {
"created": "6030199"
}
}
}
},
".monitoring-kibana-6-2018.07.25": {
"settings": {
"index": {
"codec": "best_compression",
"number_of_shards": "1",
"auto_expand_replicas": "0-1",
"provided_name": ".monitoring-kibana-6-2018.07.25",
"format": "6",
"creation_date": "1532476807789",
"number_of_replicas": "1",
"uuid": "S5IQx4moRJKjEOS7K9tVTA",
"version": {
"created": "6030199"
}
}
}
},
".kibana": {
"settings": {
"index": {
"number_of_shards": "1",
"auto_expand_replicas": "0-1",
"provided_name": ".kibana",
"creation_date": "1532333518766",
"number_of_replicas": "1",
"uuid": "qjp9B_YrRBi7LvZkK5mO2A",
"version": {
"created": "6030199"
}
}
}
},
....

2 Likes

I wonder if you need to do it that way:

PUT /*/_settings
{
 "index" : {
  "number_of_replicas":0
 }
}

Or one by one...

3 Likes

It doesnt work I tried both * or one by one and i cant change any . index like .kibana, .watches, .security-6. .monitoritng,etc .... any idea?

PUT /.kibana/_settings
{
"index" : {
"number_of_replicas":0
}
}

get /.kibana/_settings
{
".kibana": {
"settings": {
"index": {
"number_of_shards": "1",
"auto_expand_replicas": "0-1",
"provided_name": ".kibana",
"creation_date": "1532333518766",
"number_of_replicas": "1",
"uuid": "qjp9B_YrRBi7LvZkK5mO2A",
"version": {
"created": "6030199"
}
}
}
}
}

I agree it should not make a difference, but I would try using the API and see if you get any response back other than "acknowleged":true

curl -XPUT -H 'Content-Type: application/json' 'localhost:9200/.monitoring-kibana-6-2018.07.25/_settings' -d '{ "number_of_replicas" : 0 } }'

I am using elastic hosted cloud instance so i cant ssh to run that curl command but i run from another computer and it still doesnt change anything.

Is it in cloud.elastic.co?

yes it is in cloud.elatic.co

So in cloud you can have a Kibana instance deployed. Did you do that?
If so, just open Kibana and the developer console.
Then you can paste the curl command in.

How did you run previously the commands?

yes i have kibana and i run the commands previously but it doesnt change number of replicas for .* indices just for regular indices.

I was replying to michaelm14 that was asking to run curl commands on ssh cand i cant do that on cloud.

But i already tried in kibana in dev console to run:

PUT /.kibana/_settings
{
"index" : {
"number_of_replicas":0
}
}

What is the output of:

GET _cat/nodes?v

ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.25.123.145 55 98 16 7.01 9.59 15.30 mdi - instance-0000000001
172.25.153.69 52 99 35 15.80 14.31 13.40 mdi - instance-0000000000
172.25.48.246 33 99 4 0.40 0.41 0.34 m * tiebreaker-0000000002

So I guess this is caused by "auto_expand_replicas": "0-1" which basically means "replicate if you can"...

and is possible to modify that settings to alow set number of replicas to 0?

I don't know. Sounds like a new setting I never used.

May be:

PUT /.kibana/_settings
{
 "index" : {
  "number_of_replicas":0,
  "auto_expand_replicas": false
 }
}

More here: https://www.elastic.co/guide/en/elasticsearch/reference/6.3/index-modules.html#dynamic-index-settings

3 Likes

thanks! that worked

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