# Default parent/child mapping strange behavior

**URL:** <https://discuss.elastic.co/t/default-parent-child-mapping-strange-behavior/12482>\
**Category:** Elasticsearch\
**Created:** [June 19, 2013, 7:39pm UTC](https://discuss.elastic.co/t/default-parent-child-mapping-strange-behavior/12482 "2013-06-19T19:39:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Bellora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_bellora/32/74372_2.png) [@Paul\_Bellora](https://discuss.elastic.co/u/Paul_Bellora)\
**Post date:** [June 19, 2013, 7:39pm UTC](https://discuss.elastic.co/t/default-parent-child-mapping-strange-behavior/12482/1 "2013-06-19T19:39:00Z")

</div>

I have the following default-mapping.json, which specifies foo as the child  
of bar:

{  
"foo" : {  
"\_parent" : {  
"type" : "bar"  
},  
"\_routing" : {  
"required" : true  
}  
}  
}

Starting with a fresh index, I index an object of a new, totally unrelated  
type:

curl -X PUT localhost:9200/test/qux/1 -d '{  
"name" : "Bill"  
}'

If I then look at the auto-created mapping,

curl localhost:9200/test/\_mapping?pretty=true

I see this:

{  
"test" : {  
"qux" : {  
"\_parent" : {  
"type" : "bar"  
},  
"\_routing" : {  
"required" : true  
},  
"properties" : {  
"name" : {  
"type" : "string"  
}  
}  
}  
}  
}

Why is this happening? Besides simply being wrong it's breaking updates to  
qux objects because routing is required. Is my default-mapping.json defined  
incorrectly?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 24, 2013, 2:08pm UTC](https://discuss.elastic.co/t/default-parent-child-mapping-strange-behavior/12482/2 "2013-06-24T14:08:02Z")

</div>

Hey,

the default-mapping.json is always applied, regardless of the type. Maybe  
you are better off with index templates?

--Alex

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:29am UTC](https://discuss.elastic.co/t/default-parent-child-mapping-strange-behavior/12482/3 "2017-07-06T02:29:46Z")

</div>


