This topic created in 2991 days ago, the information mentioned may be changed or developed.
es 里面每条数据结构如下
postid,commentid,comment,starts
1 1 ×××× 3
1 2 ×××× 4
2 3 ×××× 1
2 4 ×××× 0
我想选出来每一个帖子下面的评论 starts 最高的一条该怎么做呢?
6 replies • 2018-06-03 13:38:09 +08:00
 |
|
1
klakekent Mar 30, 2018
我想得到的结果大概就是 1 2 ××× 4 2 3 ××× 1
|
 |
|
3
klakekent Mar 30, 2018
我发现用 aggs 和 top_hits 组合会有个问题,就是比如我的 postid 有 6 条评论,但是通过这个方式选出来显示 total 数量不足 6 条
|
 |
|
4
turan12 Mar 30, 2018
max(stars) + group by postid
|
 |
|
5
Hieast Mar 31, 2018 via Android
使用 terms postid 桶,每个桶里取 max starts
|