# Start a plugin action on elasticsearch start

**URL:** <https://discuss.elastic.co/t/start-a-plugin-action-on-elasticsearch-start/280398>\
**Category:** Elasticsearch\
**Created:** [August 4, 2021, 8:18am UTC](https://discuss.elastic.co/t/start-a-plugin-action-on-elasticsearch-start/280398 "2021-08-04T08:18:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aza-zil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aza-zil/32/92217_2.png) [@aza-zil](https://discuss.elastic.co/u/aza-zil)\
**Post date:** [August 4, 2021, 8:18am UTC](https://discuss.elastic.co/t/start-a-plugin-action-on-elasticsearch-start/280398/1 "2021-08-04T08:18:14Z")

</div>

I am trying to create a new ActionPlugin. On ES starting, I want to create a NodeClient and do some work with it. How can I do that?

---

<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:** [August 4, 2021, 8:51am UTC](https://discuss.elastic.co/t/start-a-plugin-action-on-elasticsearch-start/280398/2 "2021-08-04T08:51:04Z")

</div>

Do you really want to do that when your node is starting, or when it has joined a cluster and the node is ready to serve requests? There are some listeners that sound like a better way.

The `Plugin.createComponents` method passes a `Client` that you can use, there is no need to create your own.

---

<div class="post-metadata">

**Author:** ![aza-zil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aza-zil/32/92217_2.png) [@aza-zil](https://discuss.elastic.co/u/aza-zil)\
**Post date:** [August 4, 2021, 9:39am UTC](https://discuss.elastic.co/t/start-a-plugin-action-on-elasticsearch-start/280398/3 "2021-08-04T09:39:43Z")

</div>

I need to do that when it has joined a cluster and the node is ready to serve requests.  
can you provide some links to the listeners use, and the `Plugin.createComponents`?  
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:** [August 4, 2021, 11:31am UTC](https://discuss.elastic.co/t/start-a-plugin-action-on-elasticsearch-start/280398/4 "2021-08-04T11:31:47Z")

</div>

The example plugins are a good place to start. See [elasticsearch/plugins/examples at 7.14 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/tree/7.14/plugins/examples)

---

<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 1, 2021, 11:31am UTC](https://discuss.elastic.co/t/start-a-plugin-action-on-elasticsearch-start/280398/5 "2021-09-01T11:31:53Z")

</div>

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