我有以下文件:
"_index": String,
"_type": String,
"_id": String,
"_source": {
"id": String
"sendDate": Date
"title": String
"author": String
"language": String
"keywords": Array<String>
}
我想从数据库中列出并计算整个类型中的每个关键字。你有什么提示吗?
答案 0 :(得分:1)
所以这是答案
{
"size": 0,
"aggs": {
"item": {
"terms": {
"field": "keyWords.raw",
"size": 1000000
}
},
"total_terms": {
"cardinality": {
"field": "keyWords.raw"
}
}
}
}