# How to Execute Custom Plugin in Data Nodes not in Master Node

**URL:** <https://discuss.elastic.co/t/how-to-execute-custom-plugin-in-data-nodes-not-in-master-node/161119>\
**Category:** Elasticsearch\
**Created:** [December 17, 2018, 10:29am UTC](https://discuss.elastic.co/t/how-to-execute-custom-plugin-in-data-nodes-not-in-master-node/161119 "2018-12-17T10:29:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RITESH\_AGARWAL](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@RITESH\_AGARWAL](https://discuss.elastic.co/u/RITESH_AGARWAL)\
**Post date:** [December 17, 2018, 10:29am UTC](https://discuss.elastic.co/t/how-to-execute-custom-plugin-in-data-nodes-not-in-master-node/161119/1 "2018-12-17T10:29:17Z")

</div>

The requirement is very simple to execute the Plugin in all the data nodes available.

The issue i am facing is like i install custom plugin in all the N nodes but it is always executing in the master node only. I mean to say it is not executing in distributed system and i want the request/query should execute in distributed manner always.

Please help me on this ASAP.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [December 17, 2018, 7:09pm UTC](https://discuss.elastic.co/t/how-to-execute-custom-plugin-in-data-nodes-not-in-master-node/161119/2 "2018-12-17T19:09:56Z")

</div>

Could you please describe what your plugin does? What plugin interfaces is it extending?

---

<div class="post-metadata">

**Author:** ![RITESH\_AGARWAL](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@RITESH\_AGARWAL](https://discuss.elastic.co/u/RITESH_AGARWAL)\
**Post date:** [December 18, 2018, 7:05am UTC](https://discuss.elastic.co/t/how-to-execute-custom-plugin-in-data-nodes-not-in-master-node/161119/3 "2018-12-18T07:05:35Z")

</div>

"extends Plugin implements ActionPlugin"

@Override  
public List getRestHandlers(Settings settings, RestController restController,  
ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,  
IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster)

using the above method as Override.

Aim to create custom plugin is to create query and execute and change the response into the required json format and send back to the server.

"extends BaseRestHandler" extending baseRestHandler in the main class where the rest request is coming.

If you need more info please tell me. And let me know what mistake i am doing and what changes i can do to achieve the distributed manner query execution in all the data nodes. And also how can i test it.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [December 18, 2018, 8:11pm UTC](https://discuss.elastic.co/t/how-to-execute-custom-plugin-in-data-nodes-not-in-master-node/161119/4 "2018-12-18T20:11:47Z")

</div>

More info would help. Do you have actual sample code? What does the implementation of your rest handler look like? Rest handlers should run on the node that receives the rest request. What leads you to believe your requests are only being run on master nodes? Are you sure you aren't only sending the requests to master nodes?

---

<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:** [January 15, 2019, 8:11pm UTC](https://discuss.elastic.co/t/how-to-execute-custom-plugin-in-data-nodes-not-in-master-node/161119/5 "2019-01-15T20:11:52Z")

</div>

Closed on January 15, 2019, 8:11pm UTC

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