here is the result:
"result": {
"execution_time": "2018-04-13T23:05:32.255Z",
"execution_duration": 179,
"input": {
"type": "search",
"status": "success",
"payload": {
"_shards": {
"total": 182,
"failed": 0,
"successful": 182,
"skipped": 180
},
"hits": {
"hits": [],
"total": 1,
"max_score": 0
},
"took": 29,
"timed_out": false,
"aggregations": {
"bucket_per_hour": {
"buckets": [
{
"key_as_string": "2018-04-13T22:10:00.000Z",
"doc_count": 1,
"total_count": {
"value": 1
},
"key": 1523657400000
}
]
}
}
},
and when I use this condition on the buckets array, I can access values in the first element
"condition": { "compare": { "ctx.payload.aggregations.bucket_per_hour.buckets.0.doc_count": { "gt": 0 } } },
works
however, what I really want to do is count the number of buckets.
I have tried
"condition": { "compare": { "ctx.payload.aggregations.bucket_per_hour.buckets.length": { "gt": 0 }
and
"condition": { "compare": { "ctx.payload.aggregations.bucket_per_hour.buckets.length()": { "gt": 0 }
and
"condition": { "compare": { "ctx.payload.aggregations.bucket_per_hour.buckets.size": { "gt": 0 }
and
"condition": { "compare": { "ctx.payload.aggregations.bucket_per_hour.buckets..size()": { "gt": 0 }
all of those last four attempts result in comparing "null" to 0
like this:
"compare": {
"resolved_values": {
"ctx.payload.aggregations.bucket_per_hour.buckets.length": null
If only wanted to compare to 0, I suppose I could test
"ctx.payload.aggregations.bucket_per_hour.buckets.0.bucket.doc_count == null
but I actually want to know how many buckets there are