Watcher: getting items into array with condition met


(Leandro) #1

Hello again!

I'm playing around watcher and needing some advice here.

I have created a watcher which condition is an array_compare. Once the condition is met on some of my array values, I need the related action to take only those values and not all of them for reporting purposes.

Could it be done in some way?

Extract of relevant sections follow:

This is my condition section:

"condition": {
    "array_compare": {
      "ctx.payload.aggregations.group_by_x.buckets": {
        "path": "stats_az.std_deviation",
        "lt": {
          "value": 4e-9,
          "quantifier": "some"
        }
      }
    }
}

And this is my actions section:

"actions": {
    "my-slack-action": {
      "slack": {
        "account": "myacct",
        "message": {
          "from": "watcher",
          "to": [
            "#elastic"
          ],
          "text": "Std dev is {{#ctx.payload.aggregations.group_by_x.buckets}} {{key}}:{{stats_az.std_deviation}} {{/ctx.payload.aggregations.group_by_x.buckets}}"
        }
      }
    }
  }

Thank you for your help!
Leandro.


(Alexander Reelsen) #2

You need to have another processing step that is doing exactly this filtering. This step is called a transform and should be done with a script transform, that needs to be implemented by yourself.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.