# Restoring selected indexes from a snapshot using regex in Curator?

**URL:** <https://discuss.elastic.co/t/restoring-selected-indexes-from-a-snapshot-using-regex-in-curator/281951>\
**Category:** Elasticsearch\
**Created:** [August 19, 2021, 12:04pm UTC](https://discuss.elastic.co/t/restoring-selected-indexes-from-a-snapshot-using-regex-in-curator/281951 "2021-08-19T12:04:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pradeepgm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pradeepgm/32/93437_2.png) [@pradeepgm](https://discuss.elastic.co/u/pradeepgm)\
**Post date:** [August 19, 2021, 12:04pm UTC](https://discuss.elastic.co/t/restoring-selected-indexes-from-a-snapshot-using-regex-in-curator/281951/1 "2021-08-19T12:04:05Z")

</div>

Hi,

I would like to restore selected indexes based on regex from ElasticSearch Snapshot using Curator.

For example while taking a snapshot of selected indexes we can mention the regex in filtertype as below

```
filters:
  - filtertype: pattern
    kind: regex
    value: '^value-trans-'

```

Can we apply a similar regex while restoring a snapshot? I want to restore only the selected indexes which are created everyday with a name like value-trans-2021-08-19. In this case I want to restore only the indexes with the prefix value-trans-

Thanks  
Pradeep GM

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [August 19, 2021, 2:52pm UTC](https://discuss.elastic.co/t/restoring-selected-indexes-from-a-snapshot-using-regex-in-curator/281951/2 "2021-08-19T14:52:19Z")

</div>

Elasticsearch is the tool in question here. Curator will not use regular expressions (not currently, anyway) to select which indices to restore from the list in the snapshot metadata. The `indices` parameter is used by Elasticsearch, and its value is merely passed by Curator.

According to the Elasticsearch documentation:

> Use the `indices` parameter to restore only specific data streams or indices. This parameter supports [multi-target syntax](https://www.elastic.co/guide/en/elasticsearch/reference/7.14/multi-index.html).

Regarding multi-target syntax:

> In multi-target syntax, you can use a comma-separated list to run a request on multiple resources, such as data streams, indices, or aliases: `test1,test2,test3` . You can also use [glob-like](https://en.wikipedia.org/wiki/Glob_(programming)) wildcard ( `*` ) expressions to target resources that match a pattern: `test*` or `*test` or `te*t` or `*test*` .
> 
> You can exclude targets using the `-` character: `test*,-test3` .

There is a caveat that if an alias is referenced by a glob-like wildcard, it will restore the associated index.

> For example, if `test3` is an index alias, the pattern `test*,-test3` still targets the indices for `test3` . To avoid this, exclude the concrete indices for the alias instead.

---

<div class="post-metadata">

**Author:** ![pradeepgm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pradeepgm/32/93437_2.png) [@pradeepgm](https://discuss.elastic.co/u/pradeepgm)\
**Post date:** [August 31, 2021, 11:43am UTC](https://discuss.elastic.co/t/restoring-selected-indexes-from-a-snapshot-using-regex-in-curator/281951/4 "2021-08-31T11:43:53Z")

</div>

Thanks Theuntergreek, it helped. I given as below

```auto
actions:
  snapshot-current-restore:
    action: restore
    description: >-
    options:
      repository: es-snapshot-current
      name:
      indices: [value-trans-*]
      wait_for_completion: true
      max_wait: -1
      wait_interval: 10
    filters:
      - filtertype: none

```

---

<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:** [September 28, 2021, 11:44am UTC](https://discuss.elastic.co/t/restoring-selected-indexes-from-a-snapshot-using-regex-in-curator/281951/5 "2021-09-28T11:44:22Z")

</div>

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