# Reindexing after creating a new mapping

**URL:** <https://discuss.elastic.co/t/reindexing-after-creating-a-new-mapping/119851>\
**Category:** Elasticsearch\
**Created:** [February 14, 2018, 5:22pm UTC](https://discuss.elastic.co/t/reindexing-after-creating-a-new-mapping/119851 "2018-02-14T17:22:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raghu19](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Raghu19](https://discuss.elastic.co/u/Raghu19)\
**Post date:** [February 14, 2018, 5:22pm UTC](https://discuss.elastic.co/t/reindexing-after-creating-a-new-mapping/119851/1 "2018-02-14T17:22:51Z")

</div>

hi all,  
In our elasticsearch dEV instance, the indexes are getting created like "appid-2018.01.02", "appid-2018.01.05 " ( appid-yyyy.mm.dd format) - one index for each day's data.  
In a few indexes, one of the field - logdate - is being taken as 'date' and in others the type of this field is being taken as 'text'. we would like to have this as 'text'.  
I figured out that we need to define a new mapping template and recreate indexes.  
I am trying the below steps., after creating a new template

1. find out which of those idexes where logdate is of type date
2. create a duplicate index using "POST \_reindex " (e.g. for appid-2018.02.03, the duplicate index will be created as appid-new\_2018.02.03)
3. delete the old index (appid-2018.02.03)
4. create a duplicate again using POST \_reindex (appid-2018.02.03 will be created with appid-new  
-2018.02.03 as source)

This seem to work fine. the newly created index has the logdate as 'text' type.  
But it is tedious to do this for all the indexes, one by one.

May i please know if there is any way that i can do this in a bulk . Say like all the indexes like "appid-2018\*" should be reindexed after applying the new template.

using logstash 5.1.2

many thanks in advance !

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [February 16, 2018, 10:50am UTC](https://discuss.elastic.co/t/reindexing-after-creating-a-new-mapping/119851/2 "2018-02-16T10:50:51Z")

</div>

there is no bulk-reindex I am sorry. Are you using the reindex API for this?

---

<div class="post-metadata">

**Author:** ![Raghu19](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Raghu19](https://discuss.elastic.co/u/Raghu19)\
**Post date:** [February 27, 2018, 10:57am UTC](https://discuss.elastic.co/t/reindexing-after-creating-a-new-mapping/119851/3 "2018-02-27T10:57:47Z")

</div>

thanks for your response Simon,  
ya, i used POST \_reindex to create a duplicate index, then delete the existing index.  
this process had to be repeated for every index that had the datatype as DATE for the logdate field.

---

<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 27, 2018, 10:57am UTC](https://discuss.elastic.co/t/reindexing-after-creating-a-new-mapping/119851/4 "2018-03-27T10:57:47Z")

</div>

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