# Watchers Actions Send Field Value

**URL:** https://discuss.elastic.co/t/watchers-actions-send-field-value/216424
**Category:** Kibana
**Created:** [January 24, 2020, 1:21pm UTC](https://discuss.elastic.co/t/watchers-actions-send-field-value/216424 "2020-01-24T13:21:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Andrey\_Nazim](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Andrey\_Nazim](https://discuss.elastic.co/u/Andrey_Nazim)
#### Post date: [January 24, 2020, 1:21pm UTC](https://discuss.elastic.co/t/watchers-actions-send-field-value/216424/1 "2020-01-24T13:21:51Z")

</div>

How can I send a field value in the watchers' actions (pager duty notifications)?

For example:

This one works and return number of total hits:  
"description":"Total Hits # {{ctx.payload.hits.total}}"

But I want to get the field value of the top hit:  
something like this, but it doesn't work (instead {{ctx.payload.hits.hits.get(0).\_source.fieldname}} just returns empty value):  
"description":"Top Hit Field {{ctx.payload.hits.hits.get(0).\_source.fieldname}}"

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [January 29, 2020, 10:30am UTC](https://discuss.elastic.co/t/watchers-actions-send-field-value/216424/2 "2020-01-29T10:30:24Z")

</div>

It's supposed to be something like this:

```auto
ctx.payload.hits.hits.<index>.fields.<fieldname>

```

Where index is a numeric value (would be 0 in you case) and the fieldname has to actually be the name of the field that you want to get the top hit from.

---

<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: [February 26, 2020, 10:30am UTC](https://discuss.elastic.co/t/watchers-actions-send-field-value/216424/3 "2020-02-26T10:30:29Z")

</div>

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