# Get elasticsearch hostname in watcher

**URL:** <https://discuss.elastic.co/t/get-elasticsearch-hostname-in-watcher/264093>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting, painless\
**Created:** [February 12, 2021, 8:28am UTC](https://discuss.elastic.co/t/get-elasticsearch-hostname-in-watcher/264093 "2021-02-12T08:28:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bernhard.fluehmann](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bernhard.fluehmann/32/71755_2.png) [@bernhard.fluehmann](https://discuss.elastic.co/u/bernhard.fluehmann)\
**Post date:** [February 12, 2021, 8:28am UTC](https://discuss.elastic.co/t/get-elasticsearch-hostname-in-watcher/264093/1 "2021-02-12T08:28:03Z")

</div>

I need to get the hostname of the elasticsearch node which executes a watch. As far as it seems it is not available as a ctx variable. As well it seems not possible to get it directly by painless. Does anybody know how this can be done?

---

<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 12, 2021, 8:28am UTC](https://discuss.elastic.co/t/get-elasticsearch-hostname-in-watcher/264093/2 "2021-03-12T08:28:50Z")

</div>

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