# Efficient way to replace all content of a cluster

**URL:** <https://discuss.elastic.co/t/efficient-way-to-replace-all-content-of-a-cluster/25021>\
**Category:** Elasticsearch\
**Created:** [July 7, 2015, 8:47am UTC](https://discuss.elastic.co/t/efficient-way-to-replace-all-content-of-a-cluster/25021 "2015-07-07T08:47:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [July 7, 2015, 8:47am UTC](https://discuss.elastic.co/t/efficient-way-to-replace-all-content-of-a-cluster/25021/1 "2015-07-07T08:47:51Z")

</div>

Hello Elastic experts,

If I want to replace all content of a cluster, wondering what is the most efficient way? Is there any mode of clean-up everything and batch insert new records afterwards?

thanks in advance,  
Lin

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 7, 2015, 9:31am UTC](https://discuss.elastic.co/t/efficient-way-to-replace-all-content-of-a-cluster/25021/2 "2015-07-07T09:31:02Z")

</div>

DELETE index

Then reindex

If you have enough disk you can index in a new index then switch the alias (if you have one) and delete the old one.

---

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [July 7, 2015, 5:21pm UTC](https://discuss.elastic.co/t/efficient-way-to-replace-all-content-of-a-cluster/25021/3 "2015-07-07T17:21:59Z")

</div>

Hi David,

I am interested in this solution, "If you have enough disk you can index in a new index then switch the alias (if you have one) and delete the old one.", any referred documents? Thanks.

regards,  
Lin

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 7, 2015, 6:19pm UTC](https://discuss.elastic.co/t/efficient-way-to-replace-all-content-of-a-cluster/25021/4 "2015-07-07T18:19:36Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/guide/current/index-aliases.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/index-aliases.html)

---

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [July 7, 2015, 9:11pm UTC](https://discuss.elastic.co/t/efficient-way-to-replace-all-content-of-a-cluster/25021/5 "2015-07-07T21:11:10Z")

</div>

This is the exact solution I am looking for, thanks David.

---

<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, 12:03am UTC](https://discuss.elastic.co/t/efficient-way-to-replace-all-content-of-a-cluster/25021/6 "2017-07-06T00:03:02Z")

</div>


