# Watcher - How to reference an index field value in an email body

**URL:** <https://discuss.elastic.co/t/watcher-how-to-reference-an-index-field-value-in-an-email-body/205063>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [October 24, 2019, 12:26pm UTC](https://discuss.elastic.co/t/watcher-how-to-reference-an-index-field-value-in-an-email-body/205063 "2019-10-24T12:26:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fim/32/90645_2.png) [@fim](https://discuss.elastic.co/u/fim)\
**Post date:** [October 24, 2019, 12:26pm UTC](https://discuss.elastic.co/t/watcher-how-to-reference-an-index-field-value-in-an-email-body/205063/1 "2019-10-24T12:26:10Z")

</div>

I would like to trigger a watcher alert using Kibana Watcher UI.

The condition works fine but I would like to give additional information in the email body. In my case the watcher will triggered when a transaction duration of 20 seconds has been exceeded.

I tried as follows in the body section but it won't work:

> The following transaction took over 20sec: [{{#ctx.payload.\_value}}{{url.path}}]

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/6/960d7a086f0ee1c82a7affc4e5e06759bcca0827.png)

Could somebody give me a hint how to insert values (in my case: /rest/analytics/receive) of a specific field (in my case: url.path) from the index in the email body?

The error message is: "Failed to send email to"

Thanks!

---

<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:** [October 24, 2019, 2:41pm UTC](https://discuss.elastic.co/t/watcher-how-to-reference-an-index-field-value-in-an-email-body/205063/2 "2019-10-24T14:41:42Z")

</div>

the problem here, is that you are trying to open a list element in mustache using `#`, but you are not closing it. Also, if you try to access fields from the source of a document you can use something like `ctx.payload.hits.hits.0._source.uri.path` - everything below `ctx.payload` resembles the path of a search response.

hope this helps.

---

<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:** [November 21, 2019, 2:41pm UTC](https://discuss.elastic.co/t/watcher-how-to-reference-an-index-field-value-in-an-email-body/205063/3 "2019-11-21T14:41:44Z")

</div>

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