# Understanding parent-child query

**URL:** <https://discuss.elastic.co/t/understanding-parent-child-query/82676>\
**Category:** Elasticsearch\
**Created:** [April 18, 2017, 9:33am UTC](https://discuss.elastic.co/t/understanding-parent-child-query/82676 "2017-04-18T09:33:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aayush\_Anand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aayush_anand/32/17415_2.png) [@Aayush\_Anand](https://discuss.elastic.co/u/Aayush_Anand)\
**Post date:** [April 18, 2017, 9:33am UTC](https://discuss.elastic.co/t/understanding-parent-child-query/82676/1 "2017-04-18T09:33:09Z")

</div>

Suppose A is parent type and B is child type. They are linked by some token. A has its ID by that token.

Now B has a field 'event'.  
At time t1, B type doc was indexed with 'event' = success against some parent 'A1'. Now at time t2 another doc was indexed with 'event' = fail against same parent 'A1'.

What I have to do is find all parents which never had any child or had only 'event'=success child (not a single 'event'=fail child). Is this possible?

---

<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:** [May 16, 2017, 9:44am UTC](https://discuss.elastic.co/t/understanding-parent-child-query/82676/2 "2017-05-16T09:44:08Z")

</div>

Closed on May 16, 2017, 9:44am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
