提问:布和纸怕什么?

对于aggregation的结果的排序

Elasticsearch | 作者 mnan2c | 发布于2017年06月02日 | 阅读数:7033

  "aggregations": {
"aggregations": {
"doc_count": 22,
"group_consumers": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "5927e32587c4f7bfd4276a03",
"doc_count": 4,
"keep_uniq": {
"doc_count": 2
}
},
{
"key": "5927e32587c4f7bfd4276a04",
"doc_count": 3,
"keep_uniq": {
"doc_count": 3
}
}
]
}
}
} 有人知道如何根据
keep_uniq进行排序吗?

已邀请:

mnan2c

赞同来自:

aggs如下:
 "aggs": {
"aggregations": {
"nested": {
"path": "good_events"
},
"aggs": {
"group_consumers": {
"terms":{
"field": "good_events.consumer_id"
},
"aggs": {
"keep_uniq": {
"reverse_nested": {}
}
}
}
}
}
}

 

mnan2c

赞同来自:

已找到答案,0.0,自己好嗨。。
  "aggs": {
"aggregations": {
"nested": {
"path": "good_events"
},
"aggs": {
"group_consumers": {
"terms":{
"field": "good_events.consumer_id",
"order": {
"keep_uniq": "desc"
},
"size": 6
},
"aggs": {
"keep_uniq": {
"reverse_nested": {}
}
}
}
}
}
}

要回复问题请先登录注册