# Top hits aggregation default sort

**URL:** <https://discuss.elastic.co/t/top-hits-aggregation-default-sort/19334>\
**Category:** Elasticsearch\
**Created:** [August 18, 2014, 9:52pm UTC](https://discuss.elastic.co/t/top-hits-aggregation-default-sort/19334 "2014-08-18T21:52:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [August 18, 2014, 9:52pm UTC](https://discuss.elastic.co/t/top-hits-aggregation-default-sort/19334/1 "2014-08-18T21:52:54Z")

</div>

I using the top hits aggregation with a has\_child query. In the top\_hits  
aggregation documentation it says '_By default the hits are sorted by the  
score of the main query_', but I'm not seeing that in the results for my  
query

{  
"from": 0,  
"size": 3,  
"query": {  
"has\_child": {  
"score\_mode": "max",  
"type": "child\_type",  
"query": {  
"match": {  
"myField": {  
"query": "some text"  
}  
}  
}  
}  
},  
"aggs": {  
"replies": {  
"terms": {  
"field": "parent\_type\_id",  
"size": 3  
},  
"aggs": {  
"topChildren": {  
"top\_hits": {  
"size": 1  
}  
}  
}  
}  
}  
}

the has\_child query returns three parent results with the following scores.

- doc 1 = 0.83619833
- doc 2 = 0.7210085
- doc 3 = 0.7210085

The score for the top hits aggregations are:

- first top hit aggregation = 0.29160267
- second top hit aggregation = 0.83619833
- third top hit aggregation = 0.58320534

So the 'second top hit aggregation' should be returned first followed with  
aggregations with the score 0.7210085?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [August 19, 2014, 7:47am UTC](https://discuss.elastic.co/t/top-hits-aggregation-default-sort/19334/2 "2014-08-19T07:47:07Z")

</div>

Hi Dan,

The buckets of there replies terms agg are sorted by default by their doc  
count, but the hits inside topChildren agg are sorted by default by the  
score of the query.  
I think if you sort the replies buckets by highest score you get what you  
want. In order to do this you need to define a max metric agg, that keeps  
track of the score and let the replies terms agg sort its buckets by that,  
similar to what is done in this example:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Martijn

On 18 August 2014 23:52, Dan Tuffery [dan.tuffery@gmail.com](mailto:dan.tuffery@gmail.com) wrote:

> I using the top hits aggregation with a has\_child query. In the top\_hits  
> aggregation documentation it says '_By default the hits are sorted by the  
> score of the main query_', but I'm not seeing that in the results for my  
> query
> 
> {  
> "from": 0,  
> "size": 3,  
> "query": {  
> "has\_child": {  
> "score\_mode": "max",  
> "type": "child\_type",  
> "query": {  
> "match": {  
> "myField": {  
> "query": "some text"  
> }  
> }  
> }  
> }  
> },  
> "aggs": {  
> "replies": {  
> "terms": {  
> "field": "parent\_type\_id",  
> "size": 3  
> },  
> "aggs": {  
> "topChildren": {  
> "top\_hits": {  
> "size": 1  
> }  
> }  
> }  
> }  
> }  
> }
> 
> the has\_child query returns three parent results with the following scores.
> 
> - doc 1 = 0.83619833
> - doc 2 = 0.7210085
> - doc 3 = 0.7210085
> 
> The score for the top hits aggregations are:
> 
> - first top hit aggregation = 0.29160267
> - second top hit aggregation = 0.83619833
> - third top hit aggregation = 0.58320534
> 
> So the 'second top hit aggregation' should be returned first followed with  
> aggregations with the score 0.7210085?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CA%2BA76TxPRu%2BafuMnBckEPsG87AqQCD3hfp6nCKa1kndEYLW9Zw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BA76TxPRu%2BafuMnBckEPsG87AqQCD3hfp6nCKa1kndEYLW9Zw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [August 19, 2014, 6:07pm UTC](https://discuss.elastic.co/t/top-hits-aggregation-default-sort/19334/3 "2014-08-19T18:07:18Z")

</div>

Hi Martijn,

Thanks for your response, that seems like the right approach. The problem I  
am seeing now is that the metrics aggregation is always returning 0. Even  
if I remove top\_hits out of the query the metrics aggregation still returns  
alwyas 0, so something is quite right? Here is a simplified example:

{  
"query": {  
"match": {  
"r\_message": "some text"  
}  
},  
"aggs": {  
"replies": {  
"terms": {  
"field": "myField",  
"order": {  
"top\_score": "desc"  
}  
},  
"aggs": {  
"top\_score": {  
"max": {  
"lang": "groovy",  
"script": "\_score"  
}  
}  
}  
}  
}  
}

The result is:

- aggregations: {
  - replies: {
    - buckets: [
      - {
        - key: 5643
        - doc\_count: 1
        - top\_score: {
          - value: 0  
}  
}  
]  
}  
}

This returns the following result.

On Tuesday, August 19, 2014 8:47:40 AM UTC+1, Martijn v Groningen wrote:

> Hi Dan,
> 
> The buckets of there replies terms agg are sorted by default by their doc  
> count, but the hits inside topChildren agg are sorted by default by the  
> score of the query.  
> I think if you sort the replies buckets by highest score you get what you  
> want. In order to do this you need to define a max metric agg, that keeps  
> track of the score and let the replies terms agg sort its buckets by that,  
> similar to what is done in this example:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#_field_collapse_example)
> 
> Martijn
> 
> On 18 August 2014 23:52, Dan Tuffery \<[dan.t...@gmail.com](mailto:dan.t...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > I using the top hits aggregation with a has\_child query. In the top\_hits  
> > aggregation documentation it says '_By default the hits are sorted by  
> > the score of the main query_', but I'm not seeing that in the results  
> > for my query
> > 
> > {  
> > "from": 0,  
> > "size": 3,  
> > "query": {  
> > "has\_child": {  
> > "score\_mode": "max",  
> > "type": "child\_type",  
> > "query": {  
> > "match": {  
> > "myField": {  
> > "query": "some text"  
> > }  
> > }  
> > }  
> > }  
> > },  
> > "aggs": {  
> > "replies": {  
> > "terms": {  
> > "field": "parent\_type\_id",  
> > "size": 3  
> > },  
> > "aggs": {  
> > "topChildren": {  
> > "top\_hits": {  
> > "size": 1  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > the has\_child query returns three parent results with the following  
> > scores.
> > 
> > - doc 1 = 0.83619833
> > - doc 2 = 0.7210085
> > - doc 3 = 0.7210085
> > 
> > The score for the top hits aggregations are:
> > 
> > - first top hit aggregation = 0.29160267
> > - second top hit aggregation = 0.83619833
> > - third top hit aggregation = 0.58320534
> > 
> > So the 'second top hit aggregation' should be returned first followed  
> > with aggregations with the score 0.7210085?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Met vriendelijke groet,
> 
> Martijn van Groningen

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/cd57f012-0536-421f-bf81-742fb584da7d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cd57f012-0536-421f-bf81-742fb584da7d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [August 19, 2014, 6:26pm UTC](https://discuss.elastic.co/t/top-hits-aggregation-default-sort/19334/4 "2014-08-19T18:26:57Z")

</div>

I should have looked at the documentation first 🙂 it is 'doc.score'.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Tuesday, August 19, 2014 7:07:18 PM UTC+1, Dan Tuffery wrote:

> Hi Martijn,
> 
> Thanks for your response, that seems like the right approach. The problem  
> I am seeing now is that the metrics aggregation is always returning 0. Even  
> if I remove top\_hits out of the query the metrics aggregation still returns  
> alwyas 0, so something is quite right? Here is a simplified example:
> 
> {  
> "query": {  
> "match": {  
> "r\_message": "some text"  
> }  
> },  
> "aggs": {  
> "replies": {  
> "terms": {  
> "field": "myField",  
> "order": {  
> "top\_score": "desc"  
> }  
> },  
> "aggs": {  
> "top\_score": {  
> "max": {  
> "lang": "groovy",  
> "script": "\_score"  
> }  
> }  
> }  
> }  
> }  
> }
> 
> The result is:
> 
> - aggregations: {
> - replies: {
> - buckets: [
> - {
> - key: 5643
> - doc\_count: 1
> - top\_score: {
> - value: 0  
> }  
> }  
> ]  
> }  
> }
> 
> This returns the following result.
> 
> On Tuesday, August 19, 2014 8:47:40 AM UTC+1, Martijn v Groningen wrote:
> 
> > Hi Dan,
> > 
> > The buckets of there replies terms agg are sorted by default by their doc  
> > count, but the hits inside topChildren agg are sorted by default by the  
> > score of the query.  
> > I think if you sort the replies buckets by highest score you get what you  
> > want. In order to do this you need to define a max metric agg, that keeps  
> > track of the score and let the replies terms agg sort its buckets by that,  
> > similar to what is done in this example:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#_field_collapse_example)
> > 
> > Martijn
> > 
> > On 18 August 2014 23:52, Dan Tuffery [dan.t...@gmail.com](mailto:dan.t...@gmail.com) wrote:
> > 
> > > I using the top hits aggregation with a has\_child query. In the top\_hits  
> > > aggregation documentation it says '_By default the hits are sorted by  
> > > the score of the main query_', but I'm not seeing that in the results  
> > > for my query
> > > 
> > > {  
> > > "from": 0,  
> > > "size": 3,  
> > > "query": {  
> > > "has\_child": {  
> > > "score\_mode": "max",  
> > > "type": "child\_type",  
> > > "query": {  
> > > "match": {  
> > > "myField": {  
> > > "query": "some text"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > },  
> > > "aggs": {  
> > > "replies": {  
> > > "terms": {  
> > > "field": "parent\_type\_id",  
> > > "size": 3  
> > > },  
> > > "aggs": {  
> > > "topChildren": {  
> > > "top\_hits": {  
> > > "size": 1  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > the has\_child query returns three parent results with the following  
> > > scores.
> > > 
> > > - doc 1 = 0.83619833
> > > - doc 2 = 0.7210085
> > > - doc 3 = 0.7210085
> > > 
> > > The score for the top hits aggregations are:
> > > 
> > > - first top hit aggregation = 0.29160267
> > > - second top hit aggregation = 0.83619833
> > > - third top hit aggregation = 0.58320534
> > > 
> > > So the 'second top hit aggregation' should be returned first followed  
> > > with aggregations with the score 0.7210085?
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Met vriendelijke groet,
> > 
> > Martijn van Groningen

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8967c8c1-4b3a-4c5b-822f-b1bdb86f7480%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8967c8c1-4b3a-4c5b-822f-b1bdb86f7480%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [August 19, 2014, 8:59pm UTC](https://discuss.elastic.co/t/top-hits-aggregation-default-sort/19334/5 "2014-08-19T20:59:48Z")

</div>

🙂 great that it works out

On 19 August 2014 20:26, Dan Tuffery [dan.tuffery@gmail.com](mailto:dan.tuffery@gmail.com) wrote:

> I should have looked at the documentation first 🙂 it is 'doc.score'.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_score)
> 
> On Tuesday, August 19, 2014 7:07:18 PM UTC+1, Dan Tuffery wrote:
> 
> > Hi Martijn,
> > 
> > Thanks for your response, that seems like the right approach. The problem  
> > I am seeing now is that the metrics aggregation is always returning 0. Even  
> > if I remove top\_hits out of the query the metrics aggregation still returns  
> > alwyas 0, so something is quite right? Here is a simplified example:
> > 
> > {  
> > "query": {  
> > "match": {  
> > "r\_message": "some text"  
> > }  
> > },  
> > "aggs": {  
> > "replies": {  
> > "terms": {  
> > "field": "myField",  
> > "order": {  
> > "top\_score": "desc"  
> > }  
> > },  
> > "aggs": {  
> > "top\_score": {  
> > "max": {  
> > "lang": "groovy",  
> > "script": "\_score"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > The result is:
> > 
> > - aggregations: {
> > - replies: {
> > - buckets: [
> > - {
> > - key: 5643
> > - doc\_count: 1
> > - top\_score: {
> > - value: 0  
> > }  
> > }  
> > ]  
> > }  
> > }
> > 
> > This returns the following result.
> > 
> > On Tuesday, August 19, 2014 8:47:40 AM UTC+1, Martijn v Groningen wrote:
> > 
> > > Hi Dan,
> > > 
> > > The buckets of there replies terms agg are sorted by default by their  
> > > doc count, but the hits inside topChildren agg are sorted by default by the  
> > > score of the query.  
> > > I think if you sort the replies buckets by highest score you get what  
> > > you want. In order to do this you need to define a max metric agg, that  
> > > keeps track of the score and let the replies terms agg sort its buckets by  
> > > that, similar to what is done in this example: [http://www](http://www).  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://elasticsearch.org/guide/en/elasticsearch/reference/)  
> > > current/search-aggregations-metrics-top-hits-aggregation.  
> > > html#\_field\_collapse\_example
> > > 
> > > Martijn
> > > 
> > > On 18 August 2014 23:52, Dan Tuffery [dan.t...@gmail.com](mailto:dan.t...@gmail.com) wrote:
> > > 
> > > > I using the top hits aggregation with a has\_child query. In the  
> > > > top\_hits aggregation documentation it says '_By default the hits are  
> > > > sorted by the score of the main query_', but I'm not seeing that in  
> > > > the results for my query
> > > > 
> > > > {  
> > > > "from": 0,  
> > > > "size": 3,  
> > > > "query": {  
> > > > "has\_child": {  
> > > > "score\_mode": "max",  
> > > > "type": "child\_type",  
> > > > "query": {  
> > > > "match": {  
> > > > "myField": {  
> > > > "query": "some text"  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > },  
> > > > "aggs": {  
> > > > "replies": {  
> > > > "terms": {  
> > > > "field": "parent\_type\_id",  
> > > > "size": 3  
> > > > },  
> > > > "aggs": {  
> > > > "topChildren": {  
> > > > "top\_hits": {  
> > > > "size": 1  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > the has\_child query returns three parent results with the following  
> > > > scores.
> > > > 
> > > > - doc 1 = 0.83619833
> > > > - doc 2 = 0.7210085
> > > > - doc 3 = 0.7210085
> > > > 
> > > > The score for the top hits aggregations are:
> > > > 
> > > > - first top hit aggregation = 0.29160267
> > > > - second top hit aggregation = 0.83619833
> > > > - third top hit aggregation = 0.58320534
> > > > 
> > > > So the 'second top hit aggregation' should be returned first followed  
> > > > with aggregations with the score 0.7210085?
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b6849ad-4308-4afe-a76b-80153620f74b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > Met vriendelijke groet,
> > > 
> > > Martijn van Groningen

--  
Met vriendelijke groet,

Martijn van Groningen

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CA%2BA76TygarVMd8wVgDi3dzeSPzY%2BMuuFV0kr4h-C-uY2hgynoQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BA76TygarVMd8wVgDi3dzeSPzY%2BMuuFV0kr4h-C-uY2hgynoQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:07am UTC](https://discuss.elastic.co/t/top-hits-aggregation-default-sort/19334/6 "2017-07-06T01:07:36Z")

</div>


