# Nested object - include\_in\_parent vs include\_in\_root

**URL:** <https://discuss.elastic.co/t/nested-object-include-in-parent-vs-include-in-root/15371>\
**Category:** Elasticsearch\
**Created:** [January 23, 2014, 3:32am UTC](https://discuss.elastic.co/t/nested-object-include-in-parent-vs-include-in-root/15371 "2014-01-23T03:32:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chocoheim](https://avatars.discourse-cdn.com/v4/letter/c/779978/32.png) [@chocoheim](https://discuss.elastic.co/u/chocoheim)\
**Post date:** [January 23, 2014, 3:32am UTC](https://discuss.elastic.co/t/nested-object-include-in-parent-vs-include-in-root/15371/1 "2014-01-23T03:32:51Z")

</div>

[mapping]

1. include\_in\_parent  
...  
"WORD" :{  
"type" : "nested",   
**"include\_in\_parent" : true** ,   
"properties":{  
"KEYWORD" :{"type":"string", "index": "not\_analyzed", "omit\_norms" :true, "index\_options":"docs"},  
"POS" : {"type":"string", "index": "not\_analyzed", "omit\_norms" :true, "index\_options":"docs"},  
"FREQ" : {"type":"integer", "store":"yes"}  
}  
},  
...

2. include\_in\_root  
...  
"WORD" :{  
"type" : "nested",   
**"include\_in\_root" : true** ,   
"properties":{  
"KEYWORD" :{"type":"string", "index": "not\_analyzed", "omit\_norms" :true, "index\_options":"docs", "include\_in\_all" : false},  
"POS" : {"type":"string", "index" : "no"},  
"FREQ" : {"type":"integer", "store":"yes", "include\_in\_all" : false}  
}  
},  
...

[query]  
{  
"size" : 0,  
"query" : {  
"bool" : {  
"must" : [ {  
"query\_string" : {  
"query" : "(apple AND notebook)",  
"fields" : ["WORD.KEYWORD"],  
"default\_operator" : "and"  
}  
}, {  
"range" : {  
"POST\_DATE" : {  
"from" : "2013-12-31T15:00:00.000Z",  
"to" : "2014-01-01T14:59:59.000Z",  
"include\_lower" : true,  
"include\_upper" : true  
}  
}  
} ]  
}  
},  
"facets" : {  
"compoundNouns" : {  
"terms\_stats" : {  
"key\_field" : "WORD.KEYWORD",  
"value\_field" : "WORD.FREQ",  
"size" : 2147483647  
},  
"nested" : "WORD"  
}  
}  
}

question : why mapping 2(include\_in\_root) is faster than mapping 1(include\_in\_parent)?

---

<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, 1:55am UTC](https://discuss.elastic.co/t/nested-object-include-in-parent-vs-include-in-root/15371/2 "2017-07-06T01:55:13Z")

</div>


