# Restoring to a new index

**URL:** <https://discuss.elastic.co/t/restoring-to-a-new-index/170422>\
**Category:** Elasticsearch\
**Created:** [March 1, 2019, 2:05am UTC](https://discuss.elastic.co/t/restoring-to-a-new-index/170422 "2019-03-01T02:05:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [March 1, 2019, 2:05am UTC](https://discuss.elastic.co/t/restoring-to-a-new-index/170422/1 "2019-03-01T02:05:38Z")

</div>

Hello,

I am running the following command to restore snapshot into a new index

I am grabbing quai\_report\_20170628 from the snapshot, and trying to restore to quai\_report\_20170628\_2

curl -XPOST [http://localhost:9200/\_snapshot/WC1\_BETAPROD/presence\_all\_5/](http://localhost:9200/_snapshot/WC1_BETAPROD/presence_all_5/)_restore -d '{"indices": "quai\_report\_20170628", "ignore\_unavailable": "true","rename\_pattern": "quai\_report\_20170628_(.+)","rename\_replacement":"quai\_report\_20170628\_2"}'  
{"error":{"root\_cause":[{"type":"snapshot\_restore\_exception","reason":"[WC1\_BETAPROD:presence\_all\_5] cannot restore index [quai\_report\_20170628] because it's open"}],"type":"snapshot\_restore\_exception","reason":"[WC1\_BETAPROD:presence\_all\_5] cannot restore index [quai\_report\_20170628] because it's open"},"status":500}

What am I doing wrong?

---

<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:** [March 1, 2019, 3:33am UTC](https://discuss.elastic.co/t/restoring-to-a-new-index/170422/2 "2019-03-01T03:33:56Z")

</div>

You need to close the destination index.

---

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [March 1, 2019, 5:54pm UTC](https://discuss.elastic.co/t/restoring-to-a-new-index/170422/3 "2019-03-01T17:54:15Z")

</div>

my issue was the rename pattern:

it needed to be this "rename\_pattern": "quai\_report\_20170628"  
I wasn't trying to overwrite the destination index, I was trying to create a copy of the destination index with \_2 postfix

Once I made the change, it created the index I wanted.

---

<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:** [March 29, 2019, 6:06pm UTC](https://discuss.elastic.co/t/restoring-to-a-new-index/170422/4 "2019-03-29T18:06:41Z")

</div>

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