0
私のプロジェクトでは弾性検索を使用しました。 ESにいくつかの値を保存しました。私は弾性検索から配列フィールドを照会したいと思います。私は価値の配列が何回来たかを知る必要があります。例えば、あなたは以下のコードを見ることができます。その中で、画像と価格は2倍になります。弾性検索クエリ配列フィールド
{
"missing_fields_arr": ["images", "price"]
},
{
"missing_fields_arr": ["price"]
},
{
"missing_fields_arr": ["images"]
},
{
"missing_fields_arr": ["images", "price"]
}
と私は出力が私のコードはここにある
"aggregations": {
"missing_fields": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "images, price",
"doc_count": 2
},
{
"key": "price",
"doc_count": 1
},
{
"key": "images",
"doc_count": 1
}
]
}
}
あるべき期待、
{
"query":{
"bool":{
"must":[
{
"range": {
"@timestamp":{
"gte": "2017-07-20T00:00:00.000Z",
"lte": "2017-07-28T23:59:59.999Z"
}
}
},
{
"term": {
"tracker_name": true
}
}
]
}
},
"from": 0,
"size": 0,
"aggregations" : {
"missing_fields": {"terms": {"field": "missing_fields_arr.raw", "size": 0} }
}
}