# Child Doc Count as Filter

**URL:** <https://discuss.elastic.co/t/child-doc-count-as-filter/20165>\
**Category:** Elasticsearch\
**Created:** [October 9, 2014, 2:53pm UTC](https://discuss.elastic.co/t/child-doc-count-as-filter/20165 "2014-10-09T14:53:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darren\_McDaniel](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Darren\_McDaniel](https://discuss.elastic.co/u/Darren_McDaniel)\
**Post date:** [October 9, 2014, 2:53pm UTC](https://discuss.elastic.co/t/child-doc-count-as-filter/20165/1 "2014-10-09T14:53:17Z")

</div>

I have a general question.. Say I have records in a parent/child type  
relationship where doc X is a Parent of Doc Y which and for each Y there  
are N number of documents...

What would be the best way to get all X documents where the number of Y  
documents is greater than Z?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/98a9bdad-bf19-463f-a858-5ff5ca63171f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/98a9bdad-bf19-463f-a858-5ff5ca63171f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:57am UTC](https://discuss.elastic.co/t/child-doc-count-as-filter/20165/2 "2017-07-06T00:57:16Z")

</div>

Closed on July 6, 2017, 12:57am UTC


