# MergeMappingException when putting empty mapping

**URL:** <https://discuss.elastic.co/t/mergemappingexception-when-putting-empty-mapping/7723>\
**Category:** Elasticsearch\
**Created:** [May 16, 2012, 4:23pm UTC](https://discuss.elastic.co/t/mergemappingexception-when-putting-empty-mapping/7723 "2012-05-16T16:23:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![q42jaap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/q42jaap/32/2241_2.png) [@q42jaap](https://discuss.elastic.co/u/q42jaap)\
**Post date:** [May 16, 2012, 4:23pm UTC](https://discuss.elastic.co/t/mergemappingexception-when-putting-empty-mapping/7723/1 "2012-05-16T16:23:07Z")

</div>

I PUT the following json:  
{"mytype":{}}  
to:  
indexname/mytype/\_mapping

I'm getting the following error:  
{  
"error": "MergeMappingException[Merge failed with failures {[mapper  
[myProp] of different type, current\_type [string], merged\_type  
[ObjectMapper]]}]",  
"status":400  
}

Is this an expected error?

What I'm trying to do:

- clear the mapping
- reindex an object so that it uses the dynamic\_templates again to  
reaply them.
- queue all items of the type to be resaved eventually.

I'm aware that reindexing a new mapping is a feature that's allready  
being worked on, but for now I'd like to do the reindexing manually.

---

<div class="post-metadata">

**Author:** ![q42jaap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/q42jaap/32/2241_2.png) [@q42jaap](https://discuss.elastic.co/u/q42jaap)\
**Post date:** [May 16, 2012, 4:42pm UTC](https://discuss.elastic.co/t/mergemappingexception-when-putting-empty-mapping/7723/2 "2012-05-16T16:42:11Z")

</div>

When I don't try to put an empty mapping, but get the mappping first:

curl -XGET 'indexname/mytype/\_mapping' \> mapping.json

I alter the mapping.json (I'm trying to add "index" : "not\_analyzed"  
to a property)

And then I try to PUT the mapping again:

curl -XPUT 'indexname/mytype/\_mapping' -d '  
...contents from json file...  
'

I also get the error:  
mapper [otherProp] has different index values, mapper [otherProp] has  
different index\_analyzer, mapper [otherProp] has different  
search\_analyzer

I probably assume that I can change the "index" of a property while  
there is data in the index for this type...

---

<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 17, 2012, 10:14pm UTC](https://discuss.elastic.co/t/mergemappingexception-when-putting-empty-mapping/7723/3 "2012-05-17T22:14:13Z")

</div>

You can't change the mapping of a field that is already mapping (its index  
aspect for example).

On Wed, May 16, 2012 at 7:42 PM, Jaap Taal [jaap@q42.nl](mailto:jaap@q42.nl) wrote:

> When I don't try to put an empty mapping, but get the mappping first:
> 
> curl -XGET 'indexname/mytype/\_mapping' \> mapping.json
> 
> I alter the mapping.json (I'm trying to add "index" : "not\_analyzed"  
> to a property)
> 
> And then I try to PUT the mapping again:
> 
> curl -XPUT 'indexname/mytype/\_mapping' -d '  
> ...contents from json file...  
> '
> 
> I also get the error:  
> mapper [otherProp] has different index values, mapper [otherProp] has  
> different index\_analyzer, mapper [otherProp] has different  
> search\_analyzer
> 
> I probably assume that I can change the "index" of a property while  
> there is data in the index for this type...

---

<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:28am UTC](https://discuss.elastic.co/t/mergemappingexception-when-putting-empty-mapping/7723/4 "2017-07-06T03:28:19Z")

</div>


