# Facets that include child objects in the count

**URL:** <https://discuss.elastic.co/t/facets-that-include-child-objects-in-the-count/12407>\
**Category:** Elasticsearch\
**Created:** [June 13, 2013, 7:15pm UTC](https://discuss.elastic.co/t/facets-that-include-child-objects-in-the-count/12407 "2013-06-13T19:15:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [June 13, 2013, 7:15pm UTC](https://discuss.elastic.co/t/facets-that-include-child-objects-in-the-count/12407/1 "2013-06-13T19:15:26Z")

</div>

Is there are a way to include child object in the facet count. For example,  
if in my mapping i had this structure:

{  
"myObject": {  
"properties": {  
"topCategory": {  
"type": "string",  
"name": "top",  
"category1": {  
"type": "string",  
"name": "category2",  
"category2": {  
"type": "string",  
"name": "category2"  
}  
}  
}  
}  
}  
}

And I used topCategory as a facet field, is there away to include category1  
and category2 in the count? So the facet count value for 'topCategory'  
would be 3. Also, if the user was to select the topCategory facet in the  
UI is there a way to return all three category results - so returm then in  
the results without the child/parent structure.

--  
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:31am UTC](https://discuss.elastic.co/t/facets-that-include-child-objects-in-the-count/12407/2 "2017-07-06T02:31:20Z")

</div>

Closed on July 6, 2017, 2:31am UTC


