I read (Elasticsearch aggregation order by top hit score) and follow it with partitions. The output is very strange. The last partition has the large score. Also, each partition sort the score individually.
Current result
Partition (1) [ {score:10}, {score:9}, {score:8} ]
Partition (2) [ {score:12}, {score:10}, {score:9} ]
Partition (3) [ {score:20}, {score:15}, {score:10} ]
Expected Resultt
Partition (1) [ {score:20}, {score:15}, {score:12} ]
Partition (2) [ {score:10}, {score:10}, {score:10} ]
Partition (3) [ {score:9}, {score:9}, {score:8} ]
{
"size": 0,
"query": {
"bool": {
"must": {
"multi_match": {
"query": "place",
"fields": ["name", "name.stemmed"],
"type": "best_fields"
}
}
}
},
"aggs": {
"unique_id": {
"terms": {
"field": "id",
"size": 10000,
"order": {
"max_score": "desc"
},
"include": {
"partition": 0,
"num_partitions": 3
}
},
"aggs": {
"top_places": {
"top_hits": {
"size": 1
}
},
"max_score": {
"max": {
"script": "_score"
}
}
}
}
}
}