# Info from document in watcher alert

**URL:** <https://discuss.elastic.co/t/info-from-document-in-watcher-alert/52509>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [June 11, 2016, 5:48pm UTC](https://discuss.elastic.co/t/info-from-document-in-watcher-alert/52509 "2016-06-11T17:48:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticbharat](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@elasticbharat](https://discuss.elastic.co/u/elasticbharat)\
**Post date:** [June 11, 2016, 5:48pm UTC](https://discuss.elastic.co/t/info-from-document-in-watcher-alert/52509/1 "2016-06-11T17:48:34Z")

</div>

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](http://localhost:9200/_watcher/watch/log_error_watch)' -d '{  
"trigger" : {  
"schedule" : { "interval" : "10s" }  
},  
"input" : {  
"search" : {  
"request" : {  
"indices" : ["mysecond"],  
"body" : {  
"query" : {  
"match" : {"name":"vcpe"}  
}  
}  
}  
}  
}  
}'

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 13, 2016, 8:16am UTC](https://discuss.elastic.co/t/info-from-document-in-watcher-alert/52509/2 "2016-06-13T08:16:22Z")

</div>

Hey,

First, can you use code blocks for better readability, see this [markdown documentation](http://commonmark.org/help/) 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](https://www.elastic.co/guide/en/watcher/current/actions.html), 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.

--Alex

---

<div class="post-metadata">

**Author:** ![elasticbharat](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@elasticbharat](https://discuss.elastic.co/u/elasticbharat)\
**Post date:** [June 13, 2016, 6:28pm UTC](https://discuss.elastic.co/t/info-from-document-in-watcher-alert/52509/3 "2016-06-13T18:28:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:45pm UTC](https://discuss.elastic.co/t/info-from-document-in-watcher-alert/52509/4 "2017-07-06T13:45:02Z")

</div>


