# Elasticsearch grandchild aggregation

**URL:** <https://discuss.elastic.co/t/elasticsearch-grandchild-aggregation/110443>\
**Category:** Elasticsearch\
**Created:** [December 6, 2017, 1:35am UTC](https://discuss.elastic.co/t/elasticsearch-grandchild-aggregation/110443 "2017-12-06T01:35:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrenikgala](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@shrenikgala](https://discuss.elastic.co/u/shrenikgala)\
**Post date:** [December 6, 2017, 1:35am UTC](https://discuss.elastic.co/t/elasticsearch-grandchild-aggregation/110443/1 "2017-12-06T01:35:06Z")

</div>

I have the following data model hierarchy: League cups -\> teams -\> players. League cup is the parent of teams and team is parent of players. League cup model has an attribute called country. I'm trying to write an aggregation to get list of players, and for each player get the countries he has played the league cups in. I'm having trouble writing the query. Any help is appreciated.

---

<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:** [January 3, 2018, 1:35am UTC](https://discuss.elastic.co/t/elasticsearch-grandchild-aggregation/110443/2 "2018-01-03T01:35:22Z")

</div>

Closed on January 3, 2018, 1:35am UTC

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