1
所以我有這個疑問與聚合和過濾器聚集的兩級命名timestamps_bucket_filter
添加子聚集到bucket_selector聚集
{
"size": 0,
"aggregations": {
"colors": {
"terms": {
"field": "color"
},
"aggregations": {
"timestamps": {
"date_histogram": {
"field": "timestamp",
"interval": "1m",
"order": {
"_key": "desc"
}
},
"aggregations": {
"timestamps_bucket_filter": {
"bucket_selector": {
"buckets_path": {
"counterts": "_count"
},
"script": {
"lang": "expression",
"script": "counterts <= 50"
}
}
}
}
}
}
}
}
}
現在,我想要做的是添加以下timestamps_bucket_filter
另一個子聚集,是這樣的:
{
"size": 0,
"aggregations": {
"colors": {
"terms": {
"field": "color"
},
"aggregations": {
"timestamps": {
"date_histogram": {
"field": "timestamp",
"interval": "1m",
"order": {
"_key": "desc"
}
},
"aggregations": {
"timestamps_bucket_filter": {
"bucket_selector": {
"buckets_path": {
"counterts": "_count"
},
"script": {
"lang": "expression",
"script": "counterts <= 50"
}
},
"aggregations": { <-- I would like to add this aggregation
"name": {
"terms": {
"field": "name"
}
}
}
}
}
}
}
}
}
}
不幸的是,我得到Aggregation [timestamps_bucket_filter] cannot define sub-aggregations
有任何解決方法FO那個障礙。我真的需要在我創建的過濾器腳本下獲取這些名稱。
在此先感謝。