1
在elasticsearch中,我想获得独特的条款和计数条款。获取独特条款的计数
index: doc1: filetype(multivalued): pdf, zip, zip, txt expected result: pdf: 1 zip: 2 txt: 1
我提出了这个查询,但我得到了一个错误。
"aggs": {
"uniqueTerms": {
"terms": {
"field": "filetype"
}
},
"aggs": {
"count": {
"cardinality": {
"field": "filetype"
}
}
}
}
我该如何进行查询以获得结果?
指数映射更新:
"file" : {
"properties" : {
"filetype" : {
"type" : "string",
"norms" : {
"enabled" : false
},
"fields" : {
"raw" : {
"type" : "string",
"index" : "not_analyzed",
"ignore_above" : 256
}
}
}
}
}
谢谢,但它看起来得到文件count.I需要计数每个独特的条款。 – user3413814
查询使这个结果,pdf:1,zip:1,txt:1 – user3413814
对不起,我已更新我的回答 – Val