# Duplicate/copy index

**URL:** <https://discuss.elastic.co/t/duplicate-copy-index/13819>\
**Category:** Elasticsearch\
**Created:** [October 1, 2013, 5:23pm UTC](https://discuss.elastic.co/t/duplicate-copy-index/13819 "2013-10-01T17:23:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mj1](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mj1](https://discuss.elastic.co/u/mj1)\
**Post date:** [October 1, 2013, 5:23pm UTC](https://discuss.elastic.co/t/duplicate-copy-index/13819/1 "2013-10-01T17:23:14Z")

</div>

Hi,

I have a use case where I'd like to duplicate an index and then modify the  
duplicate in order to preserve the original in case we need to rollback.  
The workflow would be:

1. Index A exists with alias pointing at it
2. Index B created by duplicating index A
3. Index B updated with new and changed records
4. Alias changed to point at Index B
5. If issue with index B is discovered, repoint alias back to index A

Does anyone have any ideas on a good way to do this?

Regards,

mj.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [October 4, 2013, 2:35pm UTC](https://discuss.elastic.co/t/duplicate-copy-index/13819/2 "2013-10-04T14:35:31Z")

</div>

Sounds good,  
you can either use your primary data source to reindex (if you have any  
database for instance), or elasticsearch directly. In that case you would  
use the SCAN search type  
([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html))  
to fetch the previously indexed documents in an optimized way. I wouldn't  
do the copy then update, but I would just index the updated copy straight  
away, as the update would in fact be a reindex and that means that you  
would end up reindexing all your documents twice.

Using aliases is definitely the way to go here.

Good luck!

Cheers  
Luca

On Tuesday, October 1, 2013 7:23:14 PM UTC+2, mj wrote:

> Hi,
> 
> I have a use case where I'd like to duplicate an index and then modify the  
> duplicate in order to preserve the original in case we need to rollback.  
> The workflow would be:
> 
> 1. Index A exists with alias pointing at it
> 2. Index B created by duplicating index A
> 3. Index B updated with new and changed records
> 4. Alias changed to point at Index B
> 5. If issue with index B is discovered, repoint alias back to index A
> 
> Does anyone have any ideas on a good way to do this?
> 
> Regards,
> 
> mj.

--  
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).  
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, 2:13am UTC](https://discuss.elastic.co/t/duplicate-copy-index/13819/3 "2017-07-06T02:13:47Z")

</div>


