# Query on nested array fields

**URL:** <https://discuss.elastic.co/t/query-on-nested-array-fields/217727>\
**Category:** Elasticsearch\
**Created:** [February 4, 2020, 6:30am UTC](https://discuss.elastic.co/t/query-on-nested-array-fields/217727 "2020-02-04T06:30:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil\_Alex](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neil_alex/32/61990_2.png) [@Neil\_Alex](https://discuss.elastic.co/u/Neil_Alex)\
**Post date:** [February 4, 2020, 6:30am UTC](https://discuss.elastic.co/t/query-on-nested-array-fields/217727/1 "2020-02-04T06:30:57Z")

</div>

Hi ,

I am trying to query an index in elasticsearch which typically consists of documents of the following structure.

Doc 1 :  
{  
"group":"pl",  
"club":[  
{  
"name":"Arsenal",  
"wins":[  
{  
"2018":22  
},  
{  
"2019":17  
}  
]  
},  
{  
"name":"Chelsea",  
"wins":[  
{  
"2018":21  
},  
{  
"2019":20  
}  
]  
}  
]  
}

Doc 2 :  
{  
"group":"pl2",  
"club":[  
{  
"name":"Arsenal",  
"wins":[  
{  
"2018":25  
},  
{  
"2019":31  
}  
]  
},  
{  
"name":"Chelsea",  
"wins":[  
{  
"2018":26  
},  
{  
"2019":24  
}  
]  
}  
]  
}  
Essentially i need to find documents by using the the condition **club name = "Arsenal" and wins in 2018 \> 25**. Can anyone help me with a possible solution for this? Unfortunately i need to keep this structure.

---

<div class="post-metadata">

**Author:** ![Neil\_Alex](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neil_alex/32/61990_2.png) [@Neil\_Alex](https://discuss.elastic.co/u/Neil_Alex)\
**Post date:** [February 4, 2020, 10:22am UTC](https://discuss.elastic.co/t/query-on-nested-array-fields/217727/2 "2020-02-04T10:22:27Z")

</div>

Fortunately found it.. Nesting an nested query inside one, did the trick. Thanks and sorry for the trouble..

---

<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:** [March 3, 2020, 10:22am UTC](https://discuss.elastic.co/t/query-on-nested-array-fields/217727/3 "2020-03-03T10:22:31Z")

</div>

Closed on March 3, 2020, 10:22am UTC

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