# Changing mapping for existing data

**URL:** https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209
**Category:** Elasticsearch
**Created:** [April 3, 2012, 2:46pm UTC](https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209 "2012-04-03T14:46:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)
#### Post date: [April 3, 2012, 2:46pm UTC](https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209/1 "2012-04-03T14:46:16Z")

</div>

Hi,

I have a problem with changing mapping of specified field. the field has  
"index":"no" and I want to change it to "index":"analyzed". Putting new  
mapping throws error. What should I do to apply new mapping for existing  
data?

Best regards.

---

<div class="post-metadata">

### Author: ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)
#### Post date: [April 3, 2012, 2:48pm UTC](https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209/2 "2012-04-03T14:48:15Z")

</div>

Sorry for mistake, I meant the other way, I want to change  
from "index":"analyzed" to "index":"no" and add "include\_in\_all":false and  
"store":"yes" 🙂

2012/4/3 Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)

> Hi,
> 
> I have a problem with changing mapping of specified field. the field has  
> "index":"no" and I want to change it to "index":"analyzed". Putting new  
> mapping throws error. What should I do to apply new mapping for existing  
> data?
> 
> Best regards.

---

<div class="post-metadata">

### Author: ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)
#### Post date: [April 3, 2012, 2:49pm UTC](https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209/3 "2012-04-03T14:49:46Z")

</div>

Summarizing, I want to do both ways :). I would really appreciate your help.

Thanks.

2012/4/3 Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)

> Sorry for mistake, I meant the other way, I want to change  
> from "index":"analyzed" to "index":"no" and add "include\_in\_all":false and  
> "store":"yes" 🙂
> 
> 2012/4/3 Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)
> 
> > Hi,
> > 
> > I have a problem with changing mapping of specified field. the field has  
> > "index":"no" and I want to change it to "index":"analyzed". Putting new  
> > mapping throws error. What should I do to apply new mapping for existing  
> > data?
> > 
> > Best regards.

---

<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: [April 3, 2012, 3:04pm UTC](https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209/4 "2012-04-03T15:04:11Z")

</div>

I'm afraid you have to clean your existing datas.  
IMHO, you can merge mappings on new fields but you can't change "core"  
mappings for existing datas.

David.

Le 3 avril 2012 à 16:49, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) a écrit :

> :). I would really appreciate your help.
> 
> Thanks.
> 
> 2012/4/3 Marcin Dojwa \< [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)  
> [mailto:m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) \>
> 
> > way, I want to change from "index":"analyzed" to "index":"no" and add  
> > "include\_in\_all":false and "store":"yes" 🙂
> > 
> > 2012/4/3 Marcin Dojwa \< [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)  
> > [mailto:m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) \>
> > 
> > > I have a problem with changing mapping of specified field. the field has  
> > > "index":"no" and I want to change it to "index":"analyzed". Putting new  
> > > mapping throws error. What should I do to apply new mapping for existing  
> > > data?
> > > 
> > > Best regards.

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [April 7, 2012, 3:35pm UTC](https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209/5 "2012-04-07T15:35:46Z")

</div>

Yea, you can't change an existing mapping "index" mapping, because it  
requires reindexing the data. You need to do it yourself (the reindexing  
part) into a fresh index with the updated mapping.

On Tue, Apr 3, 2012 at 6:04 PM, [david@pilato.fr](mailto:david@pilato.fr) [david@pilato.fr](mailto:david@pilato.fr) wrote:

> \*\*
> 
> I'm afraid you have to clean your existing datas.
> 
> IMHO, you can merge mappings on new fields but you can't change "core"  
> mappings for existing datas.
> 
> David.
> 
> Le 3 avril 2012 à 16:49, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) a écrit :
> 
> Summarizing, I want to do both ways :). I would really appreciate your  
> help.
> 
> Thanks.
> 
> 2012/4/3 Marcin Dojwa \< [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) \>
> 
> Sorry for mistake, I meant the other way, I want to change  
> from "index":"analyzed" to "index":"no" and add "include\_in\_all":false and  
> "store":"yes" 🙂
> 
> 2012/4/3 Marcin Dojwa \< [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) \>
> 
> Hi,
> 
> I have a problem with changing mapping of specified field. the field has  
> "index":"no" and I want to change it to "index":"analyzed". Putting new  
> mapping throws error. What should I do to apply new mapping for existing  
> data?
> 
> Best regards.
> 
> --  
> David Pilato  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet

---

<div class="post-metadata">

### Author: ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)
#### Post date: [April 7, 2012, 3:50pm UTC](https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209/6 "2012-04-07T15:50:21Z")

</div>

Using index aliasing is a big help for changes like this as the new index  
can be created and then the alias changed when all is done. (+2c)

On Sat, Apr 7, 2012 at 11:35 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Yea, you can't change an existing mapping "index" mapping, because it  
> requires reindexing the data. You need to do it yourself (the reindexing  
> part) into a fresh index with the updated mapping.
> 
> On Tue, Apr 3, 2012 at 6:04 PM, [david@pilato.fr](mailto:david@pilato.fr) [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > \*\*
> > 
> > I'm afraid you have to clean your existing datas.
> > 
> > IMHO, you can merge mappings on new fields but you can't change "core"  
> > mappings for existing datas.
> > 
> > David.
> > 
> > Le 3 avril 2012 à 16:49, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) a  
> > écrit :
> > 
> > Summarizing, I want to do both ways :). I would really appreciate your  
> > help.
> > 
> > Thanks.
> > 
> > 2012/4/3 Marcin Dojwa \< [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) \>
> > 
> > Sorry for mistake, I meant the other way, I want to change  
> > from "index":"analyzed" to "index":"no" and add "include\_in\_all":false and  
> > "store":"yes" 🙂
> > 
> > 2012/4/3 Marcin Dojwa \< [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) \>
> > 
> > Hi,
> > 
> > I have a problem with changing mapping of specified field. the field has  
> > "index":"no" and I want to change it to "index":"analyzed". Putting new  
> > mapping throws error. What should I do to apply new mapping for existing  
> > data?
> > 
> > Best regards.
> > 
> > --  
> > David Pilato  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet

---

<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 6, 2017, 3:33am UTC](https://discuss.elastic.co/t/changing-mapping-for-existing-data/7209/7 "2017-07-06T03:33:22Z")

</div>


