# Can re-index be used to "copy" an index?

**URL:** <https://discuss.elastic.co/t/can-re-index-be-used-to-copy-an-index/211359>\
**Category:** Elasticsearch\
**Created:** [December 10, 2019, 6:41pm UTC](https://discuss.elastic.co/t/can-re-index-be-used-to-copy-an-index/211359 "2019-12-10T18:41:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hjiop\_oop](https://avatars.discourse-cdn.com/v4/letter/h/ed8c4c/32.png) [@hjiop\_oop](https://discuss.elastic.co/u/hjiop_oop)\
**Post date:** [December 10, 2019, 6:41pm UTC](https://discuss.elastic.co/t/can-re-index-be-used-to-copy-an-index/211359/1 "2019-12-10T18:41:08Z")

</div>

Hi,

Can I use re-index to clone one whole index A into index B?

Using elasticsearch python API.

Thanks,  
hj

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [December 10, 2019, 6:42pm UTC](https://discuss.elastic.co/t/can-re-index-be-used-to-copy-an-index/211359/2 "2019-12-10T18:42:59Z")

</div>

in plain word yes

---

<div class="post-metadata">

**Author:** ![hjiop\_oop](https://avatars.discourse-cdn.com/v4/letter/h/ed8c4c/32.png) [@hjiop\_oop](https://discuss.elastic.co/u/hjiop_oop)\
**Post date:** [December 10, 2019, 6:47pm UTC](https://discuss.elastic.co/t/can-re-index-be-used-to-copy-an-index/211359/3 "2019-12-10T18:47:48Z")

</div>

Can you please give me some documentation or other resource to back this up?

---

<div class="post-metadata">

**Author:** ![agx](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@agx](https://discuss.elastic.co/u/agx)\
**Post date:** [December 10, 2019, 7:03pm UTC](https://discuss.elastic.co/t/can-re-index-be-used-to-copy-an-index/211359/4 "2019-12-10T19:03:52Z")

</div>

Assuming you've made no changes to your index templates, the basic reindex example on the Reindex API page would result in a copy of the existing index.

Just make sure your new index uses the same index template as the previous index.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)

So, if your index template matches on twitter\_\*

POST \_reindex  
{  
"source": {  
"index": "twitter\_old"  
},  
"dest": {  
"index": "twitter\_new"  
}  
}

Should result in a copy of twitter\_old in twitter\_new.

---

<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:** [January 7, 2020, 7:04pm UTC](https://discuss.elastic.co/t/can-re-index-be-used-to-copy-an-index/211359/5 "2020-01-07T19:04:01Z")

</div>

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