Is there a way to start with a bucket filter in Visual Builder?
I want to do a bucket aggregation and have the child aggs of the outer bucket generate the time series of values.
Something like this query which works just fine in the dev console:
"aggs": {
"series": {
"date_histogram": { "field": "@timestamp", "interval": "hour" } ,
"aggs": {
"bucket_by_host": {
"terms": { "field": "host" },
"aggs": {
"used" : {"sum": { "field": "server-ram-b" } },
"installed" : {"max": { "field": "host-ram-b" } },
"ratio" : { "bucket_script": { "buckets_path": { "used": "used", "installed": "installed" }, "script": " (params.used / params.installed) " } }
}
},
"total-ratio" : { "avg_bucket": { "buckets_path": "bucket_by_host>ratio " } }
}
}
}
}
