这个查询是找出匹配记录的TOP5的词,但是否可以只统计固定的某组词的词频
类似 :select word, count(*) as cnt from table_name where word in ('a', 'b', 'c', 'd') group by word order by cnt desc LIMIT 10
{
"query": {
"bool": {
"must": [
{"terms": {"content": ["word"]}}
]
}
},
"aggs": {
"top5": {
"buckets": { "field" : "content","size":5 }
}
}
}
1 个回复
medcl - 今晚打老虎。
赞同来自: