I'm currently sorting aggregation by document count, so the most relevant items are on the aggregation list, as shown below:
{
'aggs' : {
'guilds' : {
'terms' : {
'field' : 'guilds.title.original',
'order' : [{'max_score' : 'desc'}],
'aggs' : {
'max_score' : {
'script' : 'doc.score'
}
}
}
}
}
}
I want to add another sorting option to an order order array in my JSON. but when I do this:
{
'order' : [{'max_score' : 'desc'}, {"_count" : "desc"},
}
The second sort does not work. For example, when all points are equal, it should sort on demand, but it does not work.
source
share