现在有这样一个index
"mappings": {
"_doc": {
"properties": {
"userId": {
"type": "keyword"
},
"tag": {
"type": "nested",
"properties": {
"keyword": {
"type": "keyword"
},
"score": {
"type": "double"
}
}
}
}
}
}
需要对每个user的tag.keyword进行分组,然后对每个keyword里面对score取sum。
3 个回复
God_lockin
赞同来自:
filter + agg的话可能要hardcode一大堆keyword
script/pipeline的话好像也没法正确分组,直接就sum出来个最终结果了
rochy - rochy_he
赞同来自:
最后对 tag.score 子聚合求 sum 即可
God_lockin
赞同来自:
我期望的结果是: