Hi,
I have a watcher with an aggregation query.
The result of the aggregation is e.g:
"min_docs" : {
"value" : 17.0,
"keys" : [ "CID1","CID2" ]
}
I have defined the watcher condition and action defined as:
"condition": {
"compare": {
"ctx.payload.aggregations.min_docs.value": {
"lt": 100
}
}
},
"actions": {
"my-logging-action": {
"foreach": "ctx.payload.aggregations.min_docs.keys",
"max_iterations": 100,
"logging": {
"level": "info",
"text": "There are nodes with 100 documents in the last 15 minutes."
}
}
}
I want to have the key CID1 in the text for the first iteration and CID2 for the second iteration.
As you can see, the values of the array (if they are single valued) are available in ctx.payload._value, otherwise ctx.payload is a map or an array.
Hope that helps.
P.S. It'd be great, if you could format your snippets, as it makes them much easier to read. This forums supports markdown, so snippets are almost easy as cake
there is no support for this out of the box to access the original payload. What you could to in a workaround, is to have a script transform, that puts the .value field into each element of the .keys field and thus it is accessible in the mustache payload.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.