3
{
"size": 0,
"aggs": {
"categories_agg": {
"terms": {
"field": "categories",
"order": {
"_count": "desc"
}
}
}
}
}
特定のフィールドで集計を得るために、私は上記のクエリを使用しました。これは、正常に動作し、同じような結果を与える:用語集のdoc_countの範囲フィルタ
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 77445,
"max_score": 0,
"hits": []
},
"aggregations": {
"categories_agg": {
"doc_count_error_upper_bound": 794,
"sum_other_doc_count": 148316,
"buckets": [
{
"key": "Restaurants",
"doc_count": 25071
},
{
"key": "Shopping",
"doc_count": 11233
},
{
"key": "Food",
"doc_count": 9250
},
{
"key": "Beauty & Spas",
"doc_count": 6583
},
{
"key": "Health & Medical",
"doc_count": 5121
},
{
"key": "Nightlife",
"doc_count": 5088
},
{
"key": "Home Services",
"doc_count": 4785
},
{
"key": "Bars",
"doc_count": 4328
},
{
"key": "Automotive",
"doc_count": 4208
},
{
"key": "Local Services",
"doc_count": 3468
}
]
}
}
}
私は各バケットのdoc_count
上の特定の範囲内のバケットを得ることができるような方法で凝集をフィルタリングすることができます方法はありますか?
doc_count
用レンジフィルターを使用して、最大で25000
で、minは5000
私はbuckets_selectorによって問題を解決
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 77445,
"max_score": 0,
"hits": []
},
"aggregations": {
"categories_agg": {
"doc_count_error_upper_bound": 794,
"sum_other_doc_count": 148316,
"buckets": [
{
"key": "Shopping",
"doc_count": 11233
},
{
"key": "Food",
"doc_count": 9250
},
{
"key": "Beauty & Spas",
"doc_count": 6583
},
{
"key": "Health & Medical",
"doc_count": 5121
},
{
"key": "Nightlife",
"doc_count": 5088
}
]
}
}
}
私は同じ質問の答えを探しています。あなたはこれを解決することができましたか? – shivg