i have some aggs like this:
"aggregations" : {
"range_by_date" : {
"buckets" : [
{
"key" : "2020-10-04T06:27:06.912Z-*",
"from" : 1.601792826912E12,
"from_as_string" : "2020-10-04T06:27:06.912Z",
"doc_count" : 38,
"fooo" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "001",
"doc_count" : 2,
"drop" : {
"value" : 1
}
},{
"key" : "002",
"doc_count" : 2,
"drop" : {
"value" : 2
}
},{
"key" : "003",
"doc_count" : 2,
"drop" : {
"value" : 5
}
},{
"key" : "004",
"doc_count" : 2,
"drop" : {
"value" : 0
}
},{
"key" : "005",
"doc_count" : 2,
"drop" : {
"value" : 0
}
},{
"key" : "006",
"doc_count" : 2,
"drop" : {
"value" : 0
}
},{
"key" : "007",
"doc_count" : 2,
"drop" : {
"value" : 1
}
}{
"key" : "008",
"doc_count" : 2,
"drop" : {
"value" : 2
}
}{
"key" : "009",
"doc_count" : 2,
"drop" : {
"value" : 1
}
}{
"key" : "020",
"doc_count" : 2,
"drop" : {
"value" : 5
}
},{
"key" : "021",
"doc_count" : 2,
"drop" : {
"value" : 2
}
}]
}}]}}
in my condition:
ctx.payload.errors = [];
ctx.payload.values = ctx.payload.aggregations.range_by_date.buckets[0].fooo.buckets;
for(x in ctx.payload.values) {
if(x.drop.value > 2) {
ctx.payload.errors.add(x.key);
}
}
when i log ctx.payload.errors
in Log Action i see only "003"
however i expect "003, 020"
why this happen?