# Get children count using has\_child query

**URL:** <https://discuss.elastic.co/t/get-children-count-using-has-child-query/18939>\
**Category:** Elasticsearch\
**Created:** [July 29, 2014, 2:20am UTC](https://discuss.elastic.co/t/get-children-count-using-has-child-query/18939 "2014-07-29T02:20:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxime\_Nay](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@Maxime\_Nay](https://discuss.elastic.co/u/Maxime_Nay)\
**Post date:** [July 29, 2014, 2:20am UTC](https://discuss.elastic.co/t/get-children-count-using-has-child-query/18939/1 "2014-07-29T02:20:44Z")

</div>

Hi,

Is it possible to easily get the children count when performing a has\_child  
query? I am using elasticsearch 1.2.1  
In elasticsearch 1.3 I noticed min/max children. Does this mean that  
elasticsearch 1.3 would expose the child count?

Thanks!

--  
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/e5383b11-90f8-4745-967b-983cadfcc76e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e5383b11-90f8-4745-967b-983cadfcc76e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [August 4, 2014, 8:48am UTC](https://discuss.elastic.co/t/get-children-count-using-has-child-query/18939/2 "2014-08-04T08:48:07Z")

</div>

Hey

min/max\_children is part of the query to define how many children a  
matching parent document may have, but it is not exposed. A possible  
solution would be to execute a count query with a has\_parent on the matched  
parent.

--Alex

On Tue, Jul 29, 2014 at 4:20 AM, Maxime Nay [maximenay@gmail.com](mailto:maximenay@gmail.com) wrote:

> Hi,
> 
> Is it possible to easily get the children count when performing a  
> has\_child query? I am using elasticsearch 1.2.1  
> In elasticsearch 1.3 I noticed min/max children. Does this mean that  
> elasticsearch 1.3 would expose the child count?
> 
> Thanks!
> 
> --  
> 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/e5383b11-90f8-4745-967b-983cadfcc76e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e5383b11-90f8-4745-967b-983cadfcc76e%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/e5383b11-90f8-4745-967b-983cadfcc76e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e5383b11-90f8-4745-967b-983cadfcc76e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAGCwEM--nVyRiMdaG2ysr-o%3D37exjU%3DSq0E3yxZrZQb%2Bud%2B\_%3DA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM--nVyRiMdaG2ysr-o%3D37exjU%3DSq0E3yxZrZQb%2Bud%2B_%3DA%40mail.gmail.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, 1:11am UTC](https://discuss.elastic.co/t/get-children-count-using-has-child-query/18939/3 "2017-07-06T01:11:09Z")

</div>


