# Reindex keep mapping

**URL:** <https://discuss.elastic.co/t/reindex-keep-mapping/84904>\
**Category:** Elasticsearch\
**Created:** [May 8, 2017, 9:08am UTC](https://discuss.elastic.co/t/reindex-keep-mapping/84904 "2017-05-08T09:08:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rolandgolla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rolandgolla/32/17491_2.png) [@rolandgolla](https://discuss.elastic.co/u/rolandgolla)\
**Post date:** [May 8, 2017, 9:08am UTC](https://discuss.elastic.co/t/reindex-keep-mapping/84904/1 "2017-05-08T09:08:31Z")

</div>

Hi, when i reindex a index the mapping infos of the fields are lost. So my query on the new index are not working. What can i do?

---

<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:** [May 9, 2017, 7:04am UTC](https://discuss.elastic.co/t/reindex-keep-mapping/84904/2 "2017-05-09T07:04:24Z")

</div>

You should define a template for the reindex into the new index.

---

<div class="post-metadata">

**Author:** ![rolandgolla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rolandgolla/32/17491_2.png) [@rolandgolla](https://discuss.elastic.co/u/rolandgolla)\
**Post date:** [May 9, 2017, 7:30am UTC](https://discuss.elastic.co/t/reindex-keep-mapping/84904/3 "2017-05-09T07:30:03Z")

</div>

I do not know how to use templates. Now i first do a new index with the target name and map the fields. Than i run reindex to copy the docs. But this is a long and not very clean way i think ;(

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 9, 2017, 8:23am UTC](https://discuss.elastic.co/t/reindex-keep-mapping/84904/4 "2017-05-09T08:23:47Z")

</div>

This is the right way to reindex. Why don't you think it's clean? Reindex only takes care of copying the data and relies on mappings being configured. If it was copying the mappings as well, it would make it impossible to change the mappings between the source and destination indices, which is one of the main use-cases for reindexing.

---

<div class="post-metadata">

**Author:** ![rolandgolla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rolandgolla/32/17491_2.png) [@rolandgolla](https://discuss.elastic.co/u/rolandgolla)\
**Post date:** [May 9, 2017, 8:36am UTC](https://discuss.elastic.co/t/reindex-keep-mapping/84904/5 "2017-05-09T08:36:32Z")

</div>

Because it is not a exact copy that i can reuse. I need this to version indexes for a rollback function after importing.

---

<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:** [June 6, 2017, 8:46am UTC](https://discuss.elastic.co/t/reindex-keep-mapping/84904/6 "2017-06-06T08:46:35Z")

</div>

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