# "object type" and "string type" "error MapperParsingException"

**URL:** <https://discuss.elastic.co/t/object-type-and-string-type-error-mapperparsingexception/1874>\
**Category:** Elasticsearch\
**Created:** [June 3, 2015, 9:28pm UTC](https://discuss.elastic.co/t/object-type-and-string-type-error-mapperparsingexception/1874 "2015-06-03T21:28:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ardoise\_gisement](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ardoise_gisement/32/505_2.png) [@ardoise\_gisement](https://discuss.elastic.co/u/ardoise_gisement)\
**Post date:** [June 3, 2015, 9:28pm UTC](https://discuss.elastic.co/t/object-type-and-string-type-error-mapperparsingexception/1874/1 "2015-06-03T21:28:09Z")

</div>

> Objectif : put the 2 items in the same type \_mappings !

* * *

Is there another possibility to do this? (\*)  
without to disable parsing and indexing a named object.  
\*\*

> 

curl -XPUT localhost:9200/test/type1/1 -d '{  
"person" : {  
"name": {  
"first\_name" : "ard",  
"last\_name" : "oise"  
}  
}  
}' && echo

\*\*

> curl -XPUT localhost:9200/test/type1/2 -d '{  
> "person" : {  
> "name": "ardoise"  
> }  
> }' && echo

## (\*) I don't want to use the flag "enabled" : false,

because the "enabled" flag allows to disable parsing and indexing a named object  
completely. This is handy when a portion of the JSON document contains  
arbitrary JSON which should not be indexed, nor added to the mapping

\*\*

> 

curl -XPUT localhost:9200/test -d '  
{  
"settings" : {  
"index" : {  
"number\_of\_shards" : "1",  
"number\_of\_replicas" : "0"  
}  
},  
"mappings" : {  
"type1" : {  
"properties" : {  
"person" : {  
"type" : "object",  
"properties" : {  
"name" : {  
"type" : "object",  
"enabled": false  
}  
}  
}  
}  
}  
}  
}' && echo

"error":"MapperParsingException[object mapping for [type1] tried to parse field [person] as object, but got EOF, has a concrete value been provided to it?]","status":400}

---

<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:** [June 4, 2015, 5:01am UTC](https://discuss.elastic.co/t/object-type-and-string-type-error-mapperparsingexception/1874/2 "2015-06-04T05:01:13Z")

</div>

So you want the same field to be either a String or an object ?  
Not doable.

You can use dynamic templates to disable indexation of fields like "x.\*" for example. Have a look at them to see if it could help.

---

<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, 12:09am UTC](https://discuss.elastic.co/t/object-type-and-string-type-error-mapperparsingexception/1874/3 "2017-07-06T00:09:45Z")

</div>


