Info from document in watcher alert


(Bharat) #1

While the watcher sending alert, I want more information in alert. I have "mysecond" index. I have set watch like this. The index and type has additional fields like address. In alert, I want them to be available.
In elasticsearch it is equavalent to fields.
I saw scripts and alert for dynamic content. I am looking for available options rather than learning and writing groovy.

curl -XPUT 'http://localhost:9200/_watcher/watch/log_error_watch' -d '{
"trigger" : {
"schedule" : { "interval" : "10s" }
"input" : {
"search" : {
"request" : {
"indices" : [ "mysecond" ],
"body" : {
"query" : {
"match" : {"name":"vcpe"}

(Alexander Reelsen) #2


First, can you use code blocks for better readability, see this markdown documentation for help.

second, can you be more verbose regarding your use-case? If you want to extract fields from the document being returned, you can use the payload, please see the actions, on how to access parts of the search response. If you mean something else, please take the time and provide a fully fledged example.

Also there is no need to really learn groovy as a language, we just use a very very small of features here, no need to be afraid of that.


(Bharat) #3

Thanks for the response. The context is want to send more info in watcher webhook. At the time of posting, I was not aware that ctx.payload available in watcher alert. Using ctx.payload helped me. I am fine with ctx.payload.

(system) #4