# Re-sizing a cluster - Shards and Replicas - Purge?

**URL:** https://discuss.elastic.co/t/re-sizing-a-cluster-shards-and-replicas-purge/15854
**Category:** Elasticsearch
**Created:** [February 17, 2014, 5:26pm UTC](https://discuss.elastic.co/t/re-sizing-a-cluster-shards-and-replicas-purge/15854 "2014-02-17T17:26:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Tony\_Su](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@Tony\_Su](https://discuss.elastic.co/u/Tony_Su)
#### Post date: [February 17, 2014, 5:26pm UTC](https://discuss.elastic.co/t/re-sizing-a-cluster-shards-and-replicas-purge/15854/1 "2014-02-17T17:26:13Z")

</div>

The following has bearing on understanding what happens to the data store  
when Replicas are increased or decreased.

Reading about re-sizing the cluster, I've read

- Changing the number of shards requires re-indexing, so it's highly  
recommended to allocate a number of shards consistent with the max number  
of expected nodes in the cluster from the beginning.

- Replicas can be added or removed at any time without an unusual load.

So, it begs the question, I would expect that adding replicas creates new  
copies.  
But, what happens if the number of replicas is decreased?  
Is there a difference changing replica number by runtime command compared  
to starting up a node (elasticsearch.yml), particularly if replica numbers  
are decreased?  
I assume that the replica number with the highest number is removed first?  
And what about the data, is it automatically purged or left "orphaned" in  
data storage?

And if orphaned in data storage, is there a recommended way to manually  
remove the replica data no longer used?  
I would also expect that after decreasing the number of replicas, if the  
number is increased again that whole new replicas would be created and  
allocated, none of the old replicas might be checked for integrity and  
possibly re-used (same procedure as recovery).

Thx,  
Tony

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bcca6dc6-e3b7-4cfb-ae70-53ecae82e4ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bcca6dc6-e3b7-4cfb-ae70-53ecae82e4ea%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)
#### Post date: [February 18, 2014, 3:48pm UTC](https://discuss.elastic.co/t/re-sizing-a-cluster-shards-and-replicas-purge/15854/2 "2014-02-18T15:48:16Z")

</div>

When you decrease the replicas dynamically, the data is deleted from  
wherever nodes they reside in. Then when you increase it back dynamically,  
ES will then make new copies of the shards on-the-fly. Also when you set  
index.number\_of\_replicas in the YML file, that only applies to new indexes  
created after start up. If you already had an existing index prior to that  
change in the YML file, no change will be made to the replica count of that  
prior existing index.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8ed8fb2f-5c75-48c3-b90d-4ae3dcc99e88%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8ed8fb2f-5c75-48c3-b90d-4ae3dcc99e88%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Tony\_Su](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@Tony\_Su](https://discuss.elastic.co/u/Tony_Su)
#### Post date: [February 18, 2014, 5:20pm UTC](https://discuss.elastic.co/t/re-sizing-a-cluster-shards-and-replicas-purge/15854/3 "2014-02-18T17:20:33Z")

</div>

Thank you for what appears to be a complete explanation describing  
all scenarios, both runtime changes and startup (based on  
elasticsearch.yml).  
Enlightening that there are significant differences.

Tony

On Tuesday, February 18, 2014 7:48:16 AM UTC-8, Binh Ly wrote:

> When you decrease the replicas dynamically, the data is deleted from  
> wherever nodes they reside in. Then when you increase it back dynamically,  
> ES will then make new copies of the shards on-the-fly. Also when you set  
> index.number\_of\_replicas in the YML file, that only applies to new indexes  
> created after start up. If you already had an existing index prior to that  
> change in the YML file, no change will be made to the replica count of that  
> prior existing index.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b9f8ce44-0de3-4c6e-968c-40d192cd42d9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b9f8ce44-0de3-4c6e-968c-40d192cd42d9%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:49am UTC](https://discuss.elastic.co/t/re-sizing-a-cluster-shards-and-replicas-purge/15854/4 "2017-07-06T01:49:22Z")

</div>


