# Sub Aggregated Field | Watcher Action Elasticsearch

**URL:** https://discuss.elastic.co/t/sub-aggregated-field-watcher-action-elasticsearch/196734
**Category:** Elasticsearch
**Created:** [August 26, 2019, 9:16am UTC](https://discuss.elastic.co/t/sub-aggregated-field-watcher-action-elasticsearch/196734 "2019-08-26T09:16:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ntran](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@ntran](https://discuss.elastic.co/u/ntran)
#### Post date: [August 26, 2019, 9:16am UTC](https://discuss.elastic.co/t/sub-aggregated-field-watcher-action-elasticsearch/196734/1 "2019-08-26T09:16:22Z")

</div>

Hi all,

I was wondering if you could help me in figuring out how I can reference an aggregated field AND sub-aggregated field in my watcher action?  
In this example, I wish to reference `key` and `elasticid` in my watcher action. Right now, I only have `key`

// Output

> <https://gist.github.com/nhtrn/23498ebb10ca8656ca5b8b40deca3606>

Thank you in advance 🙂

---

<div class="post-metadata">

### Author: ![ntran](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@ntran](https://discuss.elastic.co/u/ntran)
#### Post date: [August 26, 2019, 9:41am UTC](https://discuss.elastic.co/t/sub-aggregated-field-watcher-action-elasticsearch/196734/2 "2019-08-26T09:41:39Z")

</div>

Found the solution - I did not specify my array

`{{second_agg.hits.hits.0.<field>}}`

---

<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: [September 23, 2019, 9:41am UTC](https://discuss.elastic.co/t/sub-aggregated-field-watcher-action-elasticsearch/196734/3 "2019-09-23T09:41:45Z")

</div>

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