# Query nested Document with all equal

**URL:** <https://discuss.elastic.co/t/query-nested-document-with-all-equal/152450>\
**Category:** Elasticsearch\
**Created:** [October 15, 2018, 8:29am UTC](https://discuss.elastic.co/t/query-nested-document-with-all-equal/152450 "2018-10-15T08:29:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishal1918es](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@vishal1918es](https://discuss.elastic.co/u/vishal1918es)\
**Post date:** [October 15, 2018, 8:29am UTC](https://discuss.elastic.co/t/query-nested-document-with-all-equal/152450/1 "2018-10-15T08:29:02Z")

</div>

Hello I have a document with nested fields as array. Is there a simple way to get the search result of "All child equal" and "All child not equal" Kind of operations?

For example I have below Document -

{  
"objectId":"1234",  
"objectName":"Frist",  
"childObjects":[  
{  
"name":"child1",  
"childState":"new",  
"childValue":"1232"  
},  
{  
"name":"child2",  
"childState":"open",  
"childValue":"1232"  
},  
{  
"name":"child3",  
"childState":"closed",  
"childValue":"1232"  
}  
]  
}

I want to find an object where whose all child record has state "new"

or

Get document where none of the child has state as "new"

---

<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:** [November 12, 2018, 8:29am UTC](https://discuss.elastic.co/t/query-nested-document-with-all-equal/152450/2 "2018-11-12T08:29:05Z")

</div>

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