# Using reindex API against multiple date-based indices

**URL:** https://discuss.elastic.co/t/using-reindex-api-against-multiple-date-based-indices/48453
**Category:** Elasticsearch
**Created:** [April 26, 2016, 3:55pm UTC](https://discuss.elastic.co/t/using-reindex-api-against-multiple-date-based-indices/48453 "2016-04-26T15:55:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rmoff](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rmoff/32/20212_2.png) [@rmoff](https://discuss.elastic.co/u/rmoff)
#### Post date: [April 26, 2016, 3:55pm UTC](https://discuss.elastic.co/t/using-reindex-api-against-multiple-date-based-indices/48453/1 "2016-04-26T15:55:13Z")

</div>

Is there a way to use the new reindex API against date-based index naming? I’m trying to avoid having to hardcode/shell script this for 300 different indices…

```
POST /_reindex 
{
  "source": {
    "index": "logstash-2015.11.01"
  },
  "dest": {
    "index": "tmp-logstash-2015.11.01"
  }
}

DELETE logstash-2015.11.01

POST /_reindex 
{
  "source": {
    "index": "tmp-logstash-2015.11.01"
  },
  "dest": {
    "index": "logstash-2015.11.01"
  }
}

DELETE tmp-logstash-2015.11.01
```

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 27, 2016, 5:44am UTC](https://discuss.elastic.co/t/using-reindex-api-against-multiple-date-based-indices/48453/2 "2016-04-27T05:44:52Z")

</div>

You can use use wildcards, but I think that'd only apply if you wanted to move from daily to weekly/monthly.

---

<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: [April 27, 2016, 1:52pm UTC](https://discuss.elastic.co/t/using-reindex-api-against-multiple-date-based-indices/48453/3 "2016-04-27T13:52:01Z")

</div>

Yeah, it doesn't have a thing to build the destination index name based on the source index name. Sorry!

---

<div class="post-metadata">

### Author: ![rmoff](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rmoff/32/20212_2.png) [@rmoff](https://discuss.elastic.co/u/rmoff)
#### Post date: [April 29, 2016, 8:05am UTC](https://discuss.elastic.co/t/using-reindex-api-against-multiple-date-based-indices/48453/4 "2016-04-29T08:05:14Z")

</div>

OK thanks. Would be a cool feature for the future 🙂

---

<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:55pm UTC](https://discuss.elastic.co/t/using-reindex-api-against-multiple-date-based-indices/48453/5 "2017-07-05T22:55:19Z")

</div>


