How can a plugin get a Client handle for the Node it's running in?

I'm authoring an Elasticsearch plugin in java that will run inside each
Elasticsearch node's same JVM. I can add REST endpoints and the like, but
what's the best way to get a Client reference for the node I'm already
running inside of?

I'm reluctant to use NodeBuilder.node().client() since that code appears to
initialize everything required to add a new node to the cluster, which is
not what I want. I just want a NodeClient of the node my plugin is already
running on.

Thanks!

--

When you bind an action to a module, the constructor should have an
injected Client reference.

RestAction example:

River example:

AFAIK, from there, it is up to the TransportAction to be executed on each
node and the TransportActions can communicate in various ways via the
ClusterService. No need for the client at that point. At least, this is
what I understood from reading the code. Not much is detailed of the inner
workings.

--
Ivan

On Thu, Dec 20, 2012 at 2:13 PM, Jeffrey Gerard jgerard@climate.com wrote:

search plugin in java that will run inside each Elasticsearch node's sam

--

Indeed, there it is in the constructor. Perfect answer, thank you Ivan!

On Thursday, December 20, 2012 4:22:20 PM UTC-6, Ivan Brusic wrote:

When you bind an action to a module, the constructor should have an
injected Client reference.

RestAction example:

https://github.com/brusic/elasticsearch-hello-world-plugin/blob/master/src/main/java/org/elasticsearch/rest/action/helloworld/HelloWorldAction.java

River example:

https://github.com/elasticsearch/elasticsearch-river-twitter/blob/master/src/main/java/org/elasticsearch/river/twitter/TwitterRiver.java

AFAIK, from there, it is up to the TransportAction to be executed on each
node and the TransportActions can communicate in various ways via the
ClusterService. No need for the client at that point. At least, this is
what I understood from reading the code. Not much is detailed of the inner
workings.

--
Ivan

On Thu, Dec 20, 2012 at 2:13 PM, Jeffrey Gerard <jge...@climate.com<javascript:>

wrote:

search plugin in java that will run inside each Elasticsearch node's sam

--