ES 使用 aggr+top_hits 按去重数量排序,解决collapse无法排序问题
POST test_*/_search?size=0
{
“aggs”: {
“top_tags”: {
“terms”: {
“field”: “test_id.keyword”,
“order”: {
“_count”: “desc”
}
},
“aggs”: {
“top_test_hits”: {
“top_hits”: {
“size”: 10
}
}
}
}
}
}