# Index.auto\_expand\_replicas

**URL:** <https://discuss.elastic.co/t/index-auto-expand-replicas/6893>\
**Category:** Elasticsearch\
**Created:** [March 5, 2012, 6:36pm UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893 "2012-03-05T18:36:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [March 5, 2012, 6:36pm UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/1 "2012-03-05T18:36:42Z")

</div>

What does this option do? The only documented values are "false" or "0-  
all". It looks like latter creates one replica per node, which is  
quite useful, but will replicas be dropped if nodes are removed? Can I  
set a max number of replicas, e.g. "0-10"?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 5, 2012, 8:32pm UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/2 "2012-03-05T20:32:54Z")

</div>

Yes, it will create a replica per node, and replicas will be dropped if nodes are removed. You can set it to "0-10" as well.

On Monday, March 5, 2012 at 8:36 PM, Eric Jain wrote:

> What does this option do? The only documented values are "false" or "0-  
> all". It looks like latter creates one replica per node, which is  
> quite useful, but will replicas be dropped if nodes are removed? Can I  
> set a max number of replicas, e.g. "0-10"?

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [March 6, 2012, 2:43am UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/3 "2012-03-06T02:43:18Z")

</div>

On Mar 5, 12:32 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Yes, it will create a replica per node, and replicas will be dropped if nodes are removed. You can set it to "0-10" as well.

Thanks; just tested this, really useful.

---

<div class="post-metadata">

**Author:** ![Josh\_Holtzman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_holtzman/32/1890_2.png) [@Josh\_Holtzman](https://discuss.elastic.co/u/Josh_Holtzman)\
**Post date:** [April 6, 2012, 10:12pm UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/4 "2012-04-06T22:12:50Z")

</div>

Is this only available in the update settings API as of 0.19.2? I tried  
adding this to the elasticsearch.json configuration file:

"index":{  
"number\_of\_shards": 2,  
"number\_of\_replicas": 0,  
"auto\_expand\_replicas": "0-all",  
...

But the expanding/contracting feature doesn't take affect until I call the  
update settings API. Is that the expected behavior?

Thanks,  
Josh

On Monday, March 5, 2012 6:43:18 PM UTC-8, Eric Jain wrote:

> On Mar 5, 12:32 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > Yes, it will create a replica per node, and replicas will be dropped if  
> > nodes are removed. You can set it to "0-10" as well.
> 
> Thanks; just tested this, really useful.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 8, 2012, 6:20pm UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/5 "2012-04-08T18:20:10Z")

</div>

It should take affect without calling update settings. Whats your full test  
case? i.e, how many nodes you start, and what happens when you create the  
index?

On Sat, Apr 7, 2012 at 1:12 AM, jholtzman [jmholtzman@gmail.com](mailto:jmholtzman@gmail.com) wrote:

> Is this only available in the update settings API as of 0.19.2? I tried  
> adding this to the elasticsearch.json configuration file:
> 
> "index":{  
> "number\_of\_shards": 2,  
> "number\_of\_replicas": 0,  
> "auto\_expand\_replicas": "0-all",  
> ...
> 
> But the expanding/contracting feature doesn't take affect until I call the  
> update settings API. Is that the expected behavior?
> 
> Thanks,  
> Josh
> 
> On Monday, March 5, 2012 6:43:18 PM UTC-8, Eric Jain wrote:
> 
> > On Mar 5, 12:32 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Yes, it will create a replica per node, and replicas will be dropped if  
> > > nodes are removed. You can set it to "0-10" as well.
> > 
> > Thanks; just tested this, really useful.

---

<div class="post-metadata">

**Author:** ![Josh\_Holtzman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_holtzman/32/1890_2.png) [@Josh\_Holtzman](https://discuss.elastic.co/u/Josh_Holtzman)\
**Post date:** [April 9, 2012, 5:33pm UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/6 "2012-04-09T17:33:33Z")

</div>

I've tried configuring this in elasticsearch.json on all 3 nodes of a  
cluster, both with "index.auto\_expand\_replicas" defined in the root of the  
file and with "auto\_expand\_replicas" nested in the "index" section. Newly  
created indexes still do not contain the "auto\_expand\_replicas" setting  
until I make a call to the update API.

$ curl -XPUT [http://localhost:9200/test](http://localhost:9200/test)  
{"ok":true,"acknowledged":true}

$ curl -XGET [http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)  
{  
"test" : {  
"settings" : {  
"index.number\_of\_shards" : "2",  
"index.number\_of\_replicas" : "0",  
"index.version.created" : "190299"  
}  
}  
}

I can stop and start nodes in the cluster, but the number\_of\_replicas value  
remains fixed at zero for all running nodes. Once I update the settings  
via the API, though, stopping and starting nodes causes the number of  
replicas to change, and the settings API shows the configuration as  
expected:

$ curl -XGET [http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)  
{  
"test" : {  
"settings" : {  
...  
"index.auto\_expand\_replicas" : "0-all"  
}  
}  
}

Thanks,  
Josh

On Sunday, April 8, 2012 11:20:10 AM UTC-7, kimchy wrote:

> It should take affect without calling update settings. Whats your full  
> test case? i.e, how many nodes you start, and what happens when you create  
> the index?
> 
> On Sat, Apr 7, 2012 at 1:12 AM, jholtzman [jmholtzman@gmail.com](mailto:jmholtzman@gmail.com) wrote:
> 
> > Is this only available in the update settings API as of 0.19.2? I tried  
> > adding this to the elasticsearch.json configuration file:
> > 
> > "index":{  
> > "number\_of\_shards": 2,  
> > "number\_of\_replicas": 0,  
> > "auto\_expand\_replicas": "0-all",  
> > ...
> > 
> > But the expanding/contracting feature doesn't take affect until I call  
> > the update settings API. Is that the expected behavior?
> > 
> > Thanks,  
> > Josh
> > 
> > On Monday, March 5, 2012 6:43:18 PM UTC-8, Eric Jain wrote:
> > 
> > > On Mar 5, 12:32 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > 
> > > > Yes, it will create a replica per node, and replicas will be dropped  
> > > > if nodes are removed. You can set it to "0-10" as well.
> > > 
> > > Thanks; just tested this, really useful.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 11, 2012, 11:27am UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/7 "2012-04-11T11:27:06Z")

</div>

Yea, its a bug when setting it in the configuration file, you can set it in  
the settings of the index when you create it. Opened an issue:  
[Setting index.auto\_expand\_replicas in the elasticsearch config file does not apply · Issue #1852 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1852) (or create an  
index template with a template of \*, with the mentioned setting).

On Mon, Apr 9, 2012 at 8:33 PM, Josh Holtzman [jmholtzman@gmail.com](mailto:jmholtzman@gmail.com) wrote:

> I've tried configuring this in elasticsearch.json on all 3 nodes of a  
> cluster, both with "index.auto\_expand\_replicas" defined in the root of the  
> file and with "auto\_expand\_replicas" nested in the "index" section. Newly  
> created indexes still do not contain the "auto\_expand\_replicas" setting  
> until I make a call to the update API.
> 
> $ curl -XPUT [http://localhost:9200/test](http://localhost:9200/test)  
> {"ok":true,"acknowledged":true}
> 
> $ curl -XGET [http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)  
> {  
> "test" : {  
> "settings" : {  
> "index.number\_of\_shards" : "2",  
> "index.number\_of\_replicas" : "0",  
> "index.version.created" : "190299"  
> }  
> }  
> }
> 
> I can stop and start nodes in the cluster, but the number\_of\_replicas  
> value remains fixed at zero for all running nodes. Once I update the  
> settings via the API, though, stopping and starting nodes causes the number  
> of replicas to change, and the settings API shows the configuration as  
> expected:
> 
> $ curl -XGET [http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)  
> {  
> "test" : {  
> "settings" : {  
> ...  
> "index.auto\_expand\_replicas" : "0-all"  
> }  
> }  
> }
> 
> Thanks,  
> Josh
> 
> On Sunday, April 8, 2012 11:20:10 AM UTC-7, kimchy wrote:
> 
> > It should take affect without calling update settings. Whats your full  
> > test case? i.e, how many nodes you start, and what happens when you create  
> > the index?
> > 
> > On Sat, Apr 7, 2012 at 1:12 AM, jholtzman [jmholtzman@gmail.com](mailto:jmholtzman@gmail.com) wrote:
> > 
> > > Is this only available in the update settings API as of 0.19.2? I tried  
> > > adding this to the elasticsearch.json configuration file:
> > > 
> > > "index":{  
> > > "number\_of\_shards": 2,  
> > > "number\_of\_replicas": 0,  
> > > "auto\_expand\_replicas": "0-all",  
> > > ...
> > > 
> > > But the expanding/contracting feature doesn't take affect until I call  
> > > the update settings API. Is that the expected behavior?
> > > 
> > > Thanks,  
> > > Josh
> > > 
> > > On Monday, March 5, 2012 6:43:18 PM UTC-8, Eric Jain wrote:
> > > 
> > > > On Mar 5, 12:32 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > > 
> > > > > Yes, it will create a replica per node, and replicas will be dropped  
> > > > > if nodes are removed. You can set it to "0-10" as well.
> > > > 
> > > > Thanks; just tested this, really useful.

---

<div class="post-metadata">

**Author:** ![Josh\_Holtzman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_holtzman/32/1890_2.png) [@Josh\_Holtzman](https://discuss.elastic.co/u/Josh_Holtzman)\
**Post date:** [April 11, 2012, 1:27pm UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/8 "2012-04-11T13:27:26Z")

</div>

Thanks for confirming and filing the issue, Shay.

Josh

On Wednesday, April 11, 2012 4:27:06 AM UTC-7, kimchy wrote:

> Yea, its a bug when setting it in the configuration file, you can set it  
> in the settings of the index when you create it. Opened an issue:  
> [Setting index.auto\_expand\_replicas in the elasticsearch config file does not apply · Issue #1852 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1852) (or create an  
> index template with a template of \*, with the mentioned setting).
> 
> On Mon, Apr 9, 2012 at 8:33 PM, Josh Holtzman [jmholtzman@gmail.com](mailto:jmholtzman@gmail.com)wrote:
> 
> > I've tried configuring this in elasticsearch.json on all 3 nodes of a  
> > cluster, both with "index.auto\_expand\_replicas" defined in the root of the  
> > file and with "auto\_expand\_replicas" nested in the "index" section. Newly  
> > created indexes still do not contain the "auto\_expand\_replicas" setting  
> > until I make a call to the update API.
> > 
> > $ curl -XPUT [http://localhost:9200/test](http://localhost:9200/test)  
> > {"ok":true,"acknowledged":true}
> > 
> > $ curl -XGET [http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)  
> > {  
> > "test" : {  
> > "settings" : {  
> > "index.number\_of\_shards" : "2",  
> > "index.number\_of\_replicas" : "0",  
> > "index.version.created" : "190299"  
> > }  
> > }  
> > }
> > 
> > I can stop and start nodes in the cluster, but the number\_of\_replicas  
> > value remains fixed at zero for all running nodes. Once I update the  
> > settings via the API, though, stopping and starting nodes causes the number  
> > of replicas to change, and the settings API shows the configuration as  
> > expected:
> > 
> > $ curl -XGET [http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)  
> > {  
> > "test" : {  
> > "settings" : {  
> > ...  
> > "index.auto\_expand\_replicas" : "0-all"  
> > }  
> > }  
> > }
> > 
> > Thanks,  
> > Josh
> > 
> > On Sunday, April 8, 2012 11:20:10 AM UTC-7, kimchy wrote:
> > 
> > > It should take affect without calling update settings. Whats your full  
> > > test case? i.e, how many nodes you start, and what happens when you create  
> > > the index?
> > > 
> > > On Sat, Apr 7, 2012 at 1:12 AM, jholtzman [jmholtzman@gmail.com](mailto:jmholtzman@gmail.com) wrote:
> > > 
> > > > Is this only available in the update settings API as of 0.19.2? I  
> > > > tried adding this to the elasticsearch.json configuration file:
> > > > 
> > > > "index":{  
> > > > "number\_of\_shards": 2,  
> > > > "number\_of\_replicas": 0,  
> > > > "auto\_expand\_replicas": "0-all",  
> > > > ...
> > > > 
> > > > But the expanding/contracting feature doesn't take affect until I call  
> > > > the update settings API. Is that the expected behavior?
> > > > 
> > > > Thanks,  
> > > > Josh
> > > > 
> > > > On Monday, March 5, 2012 6:43:18 PM UTC-8, Eric Jain wrote:
> > > > 
> > > > > On Mar 5, 12:32 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > > > 
> > > > > > Yes, it will create a replica per node, and replicas will be dropped  
> > > > > > if nodes are removed. You can set it to "0-10" as well.
> > > > > 
> > > > > Thanks; just tested this, really useful.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:32am UTC](https://discuss.elastic.co/t/index-auto-expand-replicas/6893/9 "2017-07-06T03:32:55Z")

</div>


