# Aggregation from multiple indicates

**URL:** <https://discuss.elastic.co/t/aggregation-from-multiple-indicates/120150>\
**Category:** Elasticsearch\
**Created:** [February 16, 2018, 10:55am UTC](https://discuss.elastic.co/t/aggregation-from-multiple-indicates/120150 "2018-02-16T10:55:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amir\_Salar\_Pourhasan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amir_salar_pourhasan/32/28097_2.png) [@Amir\_Salar\_Pourhasan](https://discuss.elastic.co/u/Amir_Salar_Pourhasan)\
**Post date:** [February 16, 2018, 10:55am UTC](https://discuss.elastic.co/t/aggregation-from-multiple-indicates/120150/1 "2018-02-16T10:55:04Z")

</div>

Hi  
I`m new in ES and I have an important question.

I have 2 collections in MongoDB "matches" and "countries" for example:

```
matches (collection) :
{
    _id : 11111,
    name: "team1",
    game: "Cup1"
    country_id : 101
},
{
    _id: 2222,
    name: "team2",
    game: "Cup1"
    country_id: 102
}

```

and

```
countries (collection) :
{
    _id: 101,
    name: 'UK'
},
{
     _id: 102,
     name: 'Spain'
}

```

And I store these date in ES same as my MongoDB. I create 2 indicate "matches" and "countries".  
Finally, I want whole match data of "team1" in one single JSON like this:

```
{
    _id: 1111,
    game: "Cup1"
    localTeam: "team1",
    country: {
       _id: 101,
       name: 'UK'
    }
 },
 {
    _id: 2222,
    game: "Cup1"
    localTeam: "team2",
    country: {
       _id: 102,
       name: 'UK'
    }
}

```

How can I do that? Basically, is my strategy a good one? What is the best practice?

---

<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 16, 2018, 10:55am UTC](https://discuss.elastic.co/t/aggregation-from-multiple-indicates/120150/2 "2018-03-16T10:55:13Z")

</div>

Closed on March 16, 2018, 10:55am UTC

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