# \[SOLVED\] Reindex with index pattern

**URL:** <https://discuss.elastic.co/t/solved-reindex-with-index-pattern/52331>\
**Category:** Elasticsearch\
**Created:** [June 9, 2016, 1:17pm UTC](https://discuss.elastic.co/t/solved-reindex-with-index-pattern/52331 "2016-06-09T13:17:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![axelfelix](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@axelfelix](https://discuss.elastic.co/u/axelfelix)\
**Post date:** [June 9, 2016, 1:17pm UTC](https://discuss.elastic.co/t/solved-reindex-with-index-pattern/52331/1 "2016-06-09T13:17:53Z")

</div>

Hi all,

I want to test the reindex API follow the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html).

Did anybody try to reindex based on pattern index, like:

> ```
> POST /_reindex
> {
> "source": {
> "index": "test*"
> },
> "dest": {
> "index": "new_test*"
> }
> }
> 
> ```

I want to match all index that contain "test" in their name.

It is working like that ? Can I reindex several indices to seceral new indices ?

Thanks in advance,  
Alex

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [June 9, 2016, 1:40pm UTC](https://discuss.elastic.co/t/solved-reindex-with-index-pattern/52331/2 "2016-06-09T13:40:46Z")

</div>

> [@axelfelix](#):
>
> Can I reindex several indices to seceral new indices ?

Reindex doesn't have any support for reversing a pattern into the destination index name. You can do with with a script. This PR:

> <https://github.com/elastic/elasticsearch/pull/18654>
>
> This can be a common case with beats in case the template changes between two ve…rsions and the old data should be reindex with the new templates.

Has documentation for how to do it in 5.0.0 with the `painless` sandboxed dynamic scripting language. You'd have to do it with groovy in 2.3 or 2.4.

The trouble with doing several indexes at once is that the process isn't incremental. They all finish at the same time.

---

<div class="post-metadata">

**Author:** ![axelfelix](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@axelfelix](https://discuss.elastic.co/u/axelfelix)\
**Post date:** [June 9, 2016, 1:42pm UTC](https://discuss.elastic.co/t/solved-reindex-with-index-pattern/52331/3 "2016-06-09T13:42:25Z")

</div>

Thanks for your quick reply !

I will do in Python.

Best regards,  
Alex

---

<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 5, 2017, 10:45pm UTC](https://discuss.elastic.co/t/solved-reindex-with-index-pattern/52331/4 "2017-07-05T22:45:01Z")

</div>

Closed on July 5, 2017, 10:45pm UTC


