# XPACK Alerting "extract" same field from all hits

**URL:** https://discuss.elastic.co/t/xpack-alerting-extract-same-field-from-all-hits/165923
**Category:** Elasticsearch
**Created:** [January 28, 2019, 12:18am UTC](https://discuss.elastic.co/t/xpack-alerting-extract-same-field-from-all-hits/165923 "2019-01-28T00:18:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adnanbaykal](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@adnanbaykal](https://discuss.elastic.co/u/adnanbaykal)
#### Post date: [January 28, 2019, 12:18am UTC](https://discuss.elastic.co/t/xpack-alerting-extract-same-field-from-all-hits/165923/1 "2019-01-28T00:18:53Z")

</div>

I am creating an alert in XPACK WATCHER -

I get the results as json but I want to extract one field from the result set (hits).

I want to achieve the following:

{{ctx.payload.hits.hits.\*.\_source.text}}"

This works when I actually put a number in place of the wildcard. How can I extract a field from the result set from all the documents?

Thanks

---

<div class="post-metadata">

### Author: ![adnanbaykal](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@adnanbaykal](https://discuss.elastic.co/u/adnanbaykal)
#### Post date: [February 6, 2019, 2:58pm UTC](https://discuss.elastic.co/t/xpack-alerting-extract-same-field-from-all-hits/165923/2 "2019-02-06T14:58:18Z")

</div>

FYI - in case someone else is also searching for this - you achieve this by defining the fields in the query statement.

---

<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: [March 6, 2019, 2:58pm UTC](https://discuss.elastic.co/t/xpack-alerting-extract-same-field-from-all-hits/165923/3 "2019-03-06T14:58:19Z")

</div>

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