# Update mapping

**URL:** <https://discuss.elastic.co/t/update-mapping/7517>\
**Category:** Elasticsearch\
**Created:** [April 30, 2012, 11:08pm UTC](https://discuss.elastic.co/t/update-mapping/7517 "2012-04-30T23:08:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 2, 2012, 4:18pm UTC](https://discuss.elastic.co/t/update-mapping/7517/2 "2012-05-02T16:18:00Z")

</div>

You can't change existing mapping type, you need to create a new index with  
the correct mapping and index the data again.

On Tue, May 1, 2012 at 2:08 AM, Gaurav Vijayvargiya \<[gvijayvargiya@gmail.com](mailto:gvijayvargiya@gmail.com)

> wrote:

> Hi
> 
> I have mapping with 'lat' and 'lon' defined as double
> 
> "location" : {  
> "dynamic" : "true",  
> "properties" : {  
> ...  
> ...  
> "lon\_lat" : {  
> "dynamic" : "true",  
> "properties" : {  
> "lon" : {  
> "type" : "double"  
> },  
> "lat" : {  
> "type" : "double"  
> }  
> }  
> },  
> ...
> 
> I want to make the type of "lon\_lat"
> 
> "location" : {  
> "properties" : {  
> "lon\_lat" : { "type" : "geo\_point"}  
> }  
> },
> 
> I get error when I try to update the mapping  
> {"error":"MergeMappingException[Merge failed with failures {[Can't  
> merge a non object mapping [lon\_lat] with an object mapping  
> [lon\_lat]]}]","status":400}
> 
> Reading previous posts, looks like this is expected. And one of the  
> solutions proposed is to recreate the index with new mapping.
> 
> In my case though, there are no existing records with "lon\_lat"
> 
> curl -XPOST '[http://localhost:9200/test/test/\_search?pretty=true](http://localhost:9200/test/test/_search?pretty=true)' -d  
> ' { "filter" : { "exists" : { "field" : "location.lon\_lat" } } }'  
> {  
> "took" : 28,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 20,  
> "successful" : 20,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 0,  
> "max\_score" : null,  
> "hits" :   
> }  
> }
> 
> Does it make anything easier for me? Or do I still need to recreate  
> the index?
> 
> What is the best way to build the new index while keeping it in sync  
> with the existing index in production environment?
> 
> Thanks  
> Gaurav

---

_[View the full topic](https://discuss.elastic.co/t/update-mapping/7517)._
