I am trying to create a watch that will trigger on a couple aggregations. Below is the results of my query and I have essentially two buckets. I'm looking to trigger on the unique count of the sub-buckets in this case is the username buckets count.
I'm trying to react on the uppercase BUCKETS portion which is the count of username buckets within the first workstation bucket. I'm thinking something like this: ctx.payload.aggregations.workstation.buckets.0.username.buckets.doc_count
Any ideas?
"aggregations": {
"workstation": {
"doc_count_error_upper_bound": 2,
"sum_other_doc_count": 73,
"buckets": [
{
"doc_count": 103,
"key": "workstation1",
"username": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"BUCKETS": [
{
"doc_count": 97,
"key": "user1"
},
{
"doc_count": 6,
"key": "user2"
}
]
}
},
{
"doc_count": 12,
"key": "workstation2",
"username": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"doc_count": 9,
"key": "user3"
},
{
"doc_count": 3,
"key": "user2"
}
]
}
},
{
"doc_count": 11,
"key": "-",
"username": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"doc_count": 11,
"key": "user3"
}
]
}
}
]
}
}