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