# ElasticSearch: Facets from child documents

**URL:** <https://discuss.elastic.co/t/elasticsearch-facets-from-child-documents/14624>\
**Category:** Elasticsearch\
**Created:** [November 28, 2013, 8:01am UTC](https://discuss.elastic.co/t/elasticsearch-facets-from-child-documents/14624 "2013-11-28T08:01:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nico](https://avatars.discourse-cdn.com/v4/letter/n/b5a626/32.png) [@nico](https://discuss.elastic.co/u/nico)\
**Post date:** [November 28, 2013, 8:01am UTC](https://discuss.elastic.co/t/elasticsearch-facets-from-child-documents/14624/1 "2013-11-28T08:01:45Z")

</div>

I have two documents in parent - child relationship and I want to get the number and also the max value of a date field from the children documents grouped by the value of the parent id. In other words, for every parent document I want to count its children and get its latest child (in a single query) and also get all the information from the parent.

I already tried more facets, but nothing seems to return the desired answer. Could anyone provide some insights about how to achieve this? Is it possible? Thank you in advance.

---

<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:04am UTC](https://discuss.elastic.co/t/elasticsearch-facets-from-child-documents/14624/2 "2017-07-06T02:04:22Z")

</div>


