Change tie breaker on aggregation

Hello.

As defined in the terms aggregation docs, Elastic uses alphabetical order as a tie-breaker for the aggregation results. However, I wanted to use the order that is returned by the query, i.e.:

hits: [
   {
      "_score": 267.65305,
      "_source": {
         "id": 1,
         "description": "BBB" 
      },
   },
   {
      "_score": 267.65305,
      "_source": {
         "id": 2,
         "description": "AAA" 
      },
   }
   
]

In this case, using an aggregation ordering by the query score, the document with id 2 returns before the one with id 1, however, in case of a score tie, I wanted to keep the query result order. Is it possible?

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