# Remove postfix of indices name on Restore

**URL:** <https://discuss.elastic.co/t/remove-postfix-of-indices-name-on-restore/276937>\
**Category:** Elasticsearch\
**Tags:** snapshot-and-restore\
**Created:** [June 24, 2021, 1:59pm UTC](https://discuss.elastic.co/t/remove-postfix-of-indices-name-on-restore/276937 "2021-06-24T13:59:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![egibrajshori](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egibrajshori/32/64749_2.png) [@egibrajshori](https://discuss.elastic.co/u/egibrajshori)\
**Post date:** [June 24, 2021, 1:59pm UTC](https://discuss.elastic.co/t/remove-postfix-of-indices-name-on-restore/276937/1 "2021-06-24T13:59:20Z")

</div>

I have a snapshot of an Elasticsearch cluster which has a number of indices. I have to restore the cluster on a new Elasticsearch cluster.

All the indices have a -reindexed postfix as part of their name. What I need to do is on Restore, I need to remove the -reindexed postfix for all of the indices. I am trying to use the rename\_pattern and rename\_replacement but due to my indices not having a standardized name I am not really sure how I can remove part of the name of all the indices using the above parameters.

```auto
POST /_snapshot/upgrade-snapshot/upgradesnapshot/_restore
{
  
  "indices": "process-reindexed, test-index-reindexed, test2-index-reindexed", 
  "rename_pattern": "*_(.+)",
  "rename_replacement": "restored_index_$1"
}

```

Ideally on the above query I need on Restore to remove the -reindexed postfix from all of my indices using rename\_pattern and rename\_replacement.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 3, 2021, 6:05pm UTC](https://discuss.elastic.co/t/remove-postfix-of-indices-name-on-restore/276937/2 "2021-07-03T18:05:45Z")

</div>

Are you looking for something like this?

```auto
POST /_snapshot/upgrade-snapshot/upgradesnapshot/_restore
{
  
  "indices": "process-reindexed, test-index-reindexed, test2-index-reindexed", 
  "rename_pattern": "(*)-reindexed",
  "rename_replacement": "$1"
}

```

---

<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 31, 2021, 6:06pm UTC](https://discuss.elastic.co/t/remove-postfix-of-indices-name-on-restore/276937/3 "2021-07-31T18:06:46Z")

</div>

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