I have the following ES response:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"calling" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "9991",
"doc_count" : 4,
"called" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "7",
"doc_count" : 4
}
]
}
},
{
"key" : "9999",
"doc_count" : 4,
"called" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [ ]
}
}
]
}
}
}
Here is my watcher action html body:
{{#ctx.payload.aggregations.calling.buckets}}
{{#called.buckets.size}}
<div>Number {{key}} called:</div>
{{#called.buckets}}
<div>{{doc_count}} times number {{key}}</div>
{{/called.buckets}}
{{/called.buckets.size}}
{{/ctx.payload.aggregations.calling.buckets}}
I want to use an if condition called.buckets.size > 0
, basically, if inner bucket is empty, do nothing. I know that Mustache is logic-less, but is there another way to accomplish this task?