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
}
}
}
}
}
ありがとうございますが、文書数を取得するように見えます。各固有の用語については数えます。 – user3413814
この結果は、pdf:1、zip:1、txt:1 – user3413814
です。申し訳ありませんが、私の回答 – Val