Hello everyone,
I have a watcher:
{
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"index-*"
],
"body": {
"query": {"match_all": {}},
"aggs": {
"group_a": {},
"group_b": {},
"group_c": {}
}
}
}
}
}
}
With the watcher action, how can I check whether the groups have data or not? For example:
If ctx.payload.aggregations.group_a.buckets.size() = 0 --> Email:
Group B:
LIST GROUP A {{key}} and {{doc_count}}
Group C:
LIST GROUP C {{key}} and {{doc_count}}
Similar to other groups, if the group has no data, it will be removed from the warning email