# Change Mapping of Existing Data

**URL:** https://discuss.elastic.co/t/change-mapping-of-existing-data/31438
**Category:** Elasticsearch
**Created:** [October 1, 2015, 6:17am UTC](https://discuss.elastic.co/t/change-mapping-of-existing-data/31438 "2015-10-01T06:17:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![krish0608](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krish0608/32/6797_2.png) [@krish0608](https://discuss.elastic.co/u/krish0608)
#### Post date: [October 1, 2015, 6:17am UTC](https://discuss.elastic.co/t/change-mapping-of-existing-data/31438/1 "2015-10-01T06:17:44Z")

</div>

I want to change my mapping.What should I do to apply new mapping for existing data?please help me out.

POST /thegame/weapons/1  
{  
"\_id": 1,  
"name": "Longsword",  
"category": "Sharp"  
}

GET /thegame/weapons/\_mapping

POST /thegame/\_close

PUT /thegame/weapons/\_mapping?ignore\_conflicts=true  
{  
"weapons": {  
"properties": {  
"name": {  
"type": "long",  
},  
"category": {  
"type": "string"  
}  
}  
}  
}

POST /thegame/\_open  
GET /thegame/\_mappings

Firstly,i put a docs it create default mapping (name:{type:string}),I want to change my default mapping (name:{type:long}).It showing me Error.  
Please help me out.  
If I reindex my data through Snapshot then also i am not able to change my mapping.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 1, 2015, 6:20am UTC](https://discuss.elastic.co/t/change-mapping-of-existing-data/31438/2 "2015-10-01T06:20:37Z")

</div>

You have you reindex the data into a new index that has the correct mapping.

---

<div class="post-metadata">

### Author: ![krish0608](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krish0608/32/6797_2.png) [@krish0608](https://discuss.elastic.co/u/krish0608)
#### Post date: [October 1, 2015, 6:22am UTC](https://discuss.elastic.co/t/change-mapping-of-existing-data/31438/3 "2015-10-01T06:22:16Z")

</div>

HOw to reindex data..please give me some solution??

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 1, 2015, 6:31am UTC](https://discuss.elastic.co/t/change-mapping-of-existing-data/31438/4 "2015-10-01T06:31:01Z")

</div>

You can e.g. use Logstash, [es-reindex](https://github.com/geronime/es-reindex), or write a custom script in e.g. Python. This has been discussed in these forums several times before so please consult the archives and come back with more specific questions.

---

<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, 11:47pm UTC](https://discuss.elastic.co/t/change-mapping-of-existing-data/31438/6 "2017-07-05T23:47:17Z")

</div>


