# How to update mapping of an index and apply it to the data already in the index?

**URL:** <https://discuss.elastic.co/t/how-to-update-mapping-of-an-index-and-apply-it-to-the-data-already-in-the-index/74832>\
**Category:** Elasticsearch\
**Created:** [February 13, 2017, 6:40am UTC](https://discuss.elastic.co/t/how-to-update-mapping-of-an-index-and-apply-it-to-the-data-already-in-the-index/74832 "2017-02-13T06:40:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishal\_Joshi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishal_joshi/32/11991_2.png) [@Vishal\_Joshi](https://discuss.elastic.co/u/Vishal_Joshi)\
**Post date:** [February 13, 2017, 6:40am UTC](https://discuss.elastic.co/t/how-to-update-mapping-of-an-index-and-apply-it-to-the-data-already-in-the-index/74832/1 "2017-02-13T06:40:43Z")

</div>

I am using Elastic Search v 2.3.1 with lucene v5.5.0. I have a requirement which wants me to update the existing mapping for the index.

The index already has a lot of documents. So, I was wondering if there is a way in which only index data is backed and restored after putting new mapping in Elastic search?

I tried the snapshot and restore way [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-snapshots.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-snapshots.html) but its brings back the old mapping and new mapping is overridden.

How can map the data already residing in index with new mapping in Elastic search?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 13, 2017, 6:59am UTC](https://discuss.elastic.co/t/how-to-update-mapping-of-an-index-and-apply-it-to-the-data-already-in-the-index/74832/2 "2017-02-13T06:59:33Z")

</div>

You can use the reindex API for that.

---

<div class="post-metadata">

**Author:** ![Vishal\_Joshi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishal_joshi/32/11991_2.png) [@Vishal\_Joshi](https://discuss.elastic.co/u/Vishal_Joshi)\
**Post date:** [February 13, 2017, 7:07am UTC](https://discuss.elastic.co/t/how-to-update-mapping-of-an-index-and-apply-it-to-the-data-already-in-the-index/74832/3 "2017-02-13T07:07:29Z")

</div>

Thanks for replying and referring me reindex api.

I read it [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-reindex.html#docs-reindex](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-reindex.html#docs-reindex) and it says it copies the snapshot. I have already tried with snapshot and it copies "data" along with "mapping" of an elastic search index.

Have I misread it? I will be trying out soon after this but does reindex copy only data?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 13, 2017, 8:34am UTC](https://discuss.elastic.co/t/how-to-update-mapping-of-an-index-and-apply-it-to-the-data-already-in-the-index/74832/4 "2017-02-13T08:34:52Z")

</div>

It means that it copies the index at a given point of time, whatever operations will happen while the reindex operation is running.

It will solve your problem.

---

<div class="post-metadata">

**Author:** ![RDU](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@RDU](https://discuss.elastic.co/u/RDU)\
**Post date:** [February 13, 2017, 9:46am UTC](https://discuss.elastic.co/t/how-to-update-mapping-of-an-index-and-apply-it-to-the-data-already-in-the-index/74832/5 "2017-02-13T09:46:39Z")

</div>

I have the same issue.  
We are running an older version of Elasticsearch (1.7) with certain mappings and analyzers. When I try to create the same mappings (via .Net components) in the newest version of Elasticsearch it fails to create. Is there a way to convert/update the mappings to the newest version. The reindex api only copies data from one index to another without mappings.

---

<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 13, 2017, 9:47am UTC](https://discuss.elastic.co/t/how-to-update-mapping-of-an-index-and-apply-it-to-the-data-already-in-the-index/74832/6 "2017-03-13T09:47:08Z")

</div>

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