カーディナリティー集約を使用して異なる値のカウントを取得しようとしています。ここフィルター集約内の基数集約
はその後
{
"size": 100,
"_source":["awardeeName"],
"query": {
"match_phrase":{"awardeeName" :"The President and Fellows of Harvard College" }
},
"aggs":{
"awardeeName": {
"filter" : { "query": { "match_phrase":{"awardeeName" :"The President and Fellows of Harvard College" }}},
"aggs": {
"distinct":{"cardinality":{ "field": "awardeeName"}}
}
}
}
}
いくつかのテキストのmatch_phraseを使用して、クエリ、同じ試合のフレーズと集計し、その結果カーディナリティ、 を呼び出し、カウント数と集計fitlerの試合を打つ私のクエリですが、カーディナリティは意外に別の番号を示していフィルタおよび総ヒット数より大きく、ここで結果
{
"took": 37,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 13.516766,
"hits": [
{
"_index": "development",
"_type": "document",
"_id": "140a3f5b-e876-4542-b16d-56c3c5ae0e58",
"_score": 13.516766,
"_source": {
"awardeeName": "The President and Fellows of Harvard College"
}
},
{
"_index": "development",
"_type": "document",
"_id": "5c668b06-c612-4349-8735-2a79ee2bb55e",
"_score": 12.913888,
"_source": {
"awardeeName": "The President and Fellows of Harvard College"
}
},
{
"_index": "development",
"_type": "document",
"_id": "a9560519-1b2a-4e64-b85f-4645a41d5810",
"_score": 12.913888,
"_source": {
"awardeeName": "The President and Fellows of Harvard College"
}
}
]
},
"aggregations": {
"awardeeName": {
"doc_count": 3,
"distinct": {
"value": 7
}
}
}
}
である私は、基数がフィルタの結果に適用することを期待するが、この場合にはカーディナリティは7を示し、なぜそれが7を示していますか?別の値のカウントは、ヒット数の合計をどのように超えることができますか?
キーワードは、値 'college'の照合クエリの場合は0レコードを返します。データ型テキストを保持するmatchとmatch_phraseの両方で検索したいのですが、別のフィールド値を数える方法はありますか? – user884424
私はこのプロパティを2つの異なるフィールドとしてマップすることができます。テキストアナライザによる全文検索とキーワードアナライザによる別個のカウントなどです。 – user884424
これは間違いなく、マルチフィールド、つまり全文検索用のフィールドとキーワードアナライザ付きの別のサブフィールドが必要になる場合があります。 – Val