# Running ES Client inside ES Plugin

**URL:** <https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420>\
**Category:** Elasticsearch\
**Created:** [April 20, 2012, 12:09pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420 "2012-04-20T12:09:07Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [April 20, 2012, 12:09pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/1 "2012-04-20T12:09:07Z")

</div>

Hello,

I'm developing ES plugin that need to get some static data (let's call it  
"list") from the ES-index.  
What is best way to do this?

Of course it can be implemented the same way as "external" ES-client  
(create client, connect to node, etc)  
But i guess there are more effective way to do this.

For example, something like: get current node, send and some kind of  
low-level request to the index needed.

Looking forward for any comments, ideas, considerations...

--  
Vadim

---

<div class="post-metadata">

**Author:** ![Alexander\_Reelsen](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Alexander\_Reelsen](https://discuss.elastic.co/u/Alexander_Reelsen)\
**Post date:** [April 20, 2012, 12:22pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/2 "2012-04-20T12:22:53Z")

</div>

Hi

On 20 Apr., 14:09, Vadim Voituk [vadim.voi...@gmail.com](mailto:vadim.voi...@gmail.com) wrote:

> Of course it can be implemented the same way as "external" ES-client  
> (create client, connect to node, etc)  
> But i guess there are more effective way to do this.  
> No need to create a client, simply use the @Inject annotation in your  
> plugin to insert a client instance - see other sample plugins and  
> rivers how they do this.  
> Or am I missing something why this is not possible in your sample?

--Alexander

---

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [April 20, 2012, 1:33pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/3 "2012-04-20T13:33:36Z")

</div>

On Friday, April 20, 2012 2:22:53 PM UTC+2, Alexander Reelsen wrote:

> > Of course it can be implemented the same way as "external" ES-client  
> > (create client, connect to node, etc)  
> > But i guess there are more effective way to do this.  
> > No need to create a client, simply use the @Inject annotation in your  
> > plugin to insert a client instance - see other sample plugins and  
> > rivers how they do this.  
> > Or am I missing something why this is not possible in your sample?

Alexander,  
thanks for your answer.  
Could you please point me to an example.

The only i found – injection of the client into child class  
BaseRestController, but in my case i need to inject it  
into NativeScriptFactory.

Something like:

public class XXXScriptFactory implements NativeScriptFactory  
@Inject Client client;  
....  
}  
But i'm getting error like:

"Initialization Failed ...

1. Tried proxying org.elasticsearch.script.ScriptService to support a  
circular dependency, but it is not an interface."

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 21, 2012, 3:07pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/4 "2012-04-21T15:07:01Z")

</div>

Add the Client to the constructor of your implementation of  
NativeScriptFactory (and make sure to have @Inject on the constructor as  
well).

On Fri, Apr 20, 2012 at 4:33 PM, Vadim Voituk [vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)wrote:

> On Friday, April 20, 2012 2:22:53 PM UTC+2, Alexander Reelsen wrote:
> 
> > > Of course it can be implemented the same way as "external" ES-client  
> > > (create client, connect to node, etc)  
> > > But i guess there are more effective way to do this.  
> > > No need to create a client, simply use the @Inject annotation in your  
> > > plugin to insert a client instance - see other sample plugins and  
> > > rivers how they do this.  
> > > Or am I missing something why this is not possible in your sample?
> 
> Alexander,  
> thanks for your answer.  
> Could you please point me to an example.
> 
> The only i found – injection of the client into child class  
> BaseRestController, but in my case i need to inject it  
> into NativeScriptFactory.
> 
> Something like:
> 
> public class XXXScriptFactory implements NativeScriptFactory  
> @Inject Client client;  
> ....  
> }  
> But i'm getting error like:
> 
> "Initialization Failed ...
> 
> 1. Tried proxying org.elasticsearch.script.ScriptService to support a  
> circular dependency, but it is not an interface."

---

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [April 23, 2012, 10:42am UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/5 "2012-04-23T10:42:19Z")

</div>

Hello, Shay

I'm trying to do in this way:

On Saturday, April 21, 2012 5:07:01 PM UTC+2, kimchy wrote:

> Add the Client to the constructor of your implementation of  
> NativeScriptFactory (and make sure to have @Inject on the constructor as  
> well).

.. and here what i getting:

1. Tried proxying org.elasticsearch.script.ScriptService to support a  
circular dependency, but it is not an interface.
2. IllegalStateException[This is a proxy used to support circular  
references involving constructors. The object we're proxying is not  
constructed yet. Please wait until after injection has completed to use  
this object.]

And here is my code:

public class PreorderSortScriptFactory implements NativeScriptFactory {  
@Inject public PreorderSortScriptFactory(Client client) {

```
    System.out.println("PreorderSortScriptFactory.PreorderSortScriptFactory() 

```

- " + client );  
}

---

<div class="post-metadata">

**Author:** ![avasilenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avasilenko/32/2901_2.png) [@avasilenko](https://discuss.elastic.co/u/avasilenko)\
**Post date:** [April 23, 2012, 10:49am UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/6 "2012-04-23T10:49:41Z")

</div>

Vadim,

Looks like you encountered circular dependencies. Have you tried injecting  
via setter?

Alexandr Vasilenko  
Skype:menterr

2012/4/23 Vadim Voituk [vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)

> Hello, Shay
> 
> I'm trying to do in this way:
> 
> On Saturday, April 21, 2012 5:07:01 PM UTC+2, kimchy wrote:
> 
> > Add the Client to the constructor of your implementation of  
> > NativeScriptFactory (and make sure to have @Inject on the constructor as  
> > well).
> 
> .. and here what i getting:
> 
> 1. Tried proxying org.elasticsearch.script.ScriptService to support a  
> circular dependency, but it is not an interface.
> 2. IllegalStateException[This is a proxy used to support circular  
> references involving constructors. The object we're proxying is not  
> constructed yet. Please wait until after injection has completed to use  
> this object.]
> 
> And here is my code:
> 
> public class PreorderSortScriptFactory implements NativeScriptFactory {  
> @Inject public PreorderSortScriptFactory(Client client) {
> 
> ```
> System.out.println("PreorderSortScriptFactory.PreorderSortScriptFactory()
> 
> ```
> 
> - " + client );  
> }

---

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [April 23, 2012, 12:44pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/7 "2012-04-23T12:44:39Z")

</div>

Hello, Alex,

On Monday, April 23, 2012 12:49:41 PM UTC+2, Alex Vasilenko wrote:

> Vadim,
> 
> Looks like you encountered circular dependencies. Have you tried injecting  
> via setter?

Yeah, ai've tried in this way too:

@Inject public void setClient(Client client) { ... }

But the error is the same.

And i don't think that there are much of differences in injection  
lifecycle there 🙂

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 25, 2012, 3:54pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/8 "2012-04-25T15:54:04Z")

</div>

Yea, I see why it happens... . Try and do the (not as nice solution) of  
injecting the factory with Injector and keep it in a field. And then, on  
newScript called on the factor, call: injector.getInstance(Client.class) to  
get the client.

On Mon, Apr 23, 2012 at 3:44 PM, Vadim Voituk [vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)wrote:

> Hello, Alex,
> 
> On Monday, April 23, 2012 12:49:41 PM UTC+2, Alex Vasilenko wrote:
> 
> > Vadim,
> > 
> > Looks like you encountered circular dependencies. Have you tried  
> > injecting via setter?
> 
> Yeah, ai've tried in this way too:
> 
> @Inject public void setClient(Client client) { ... }
> 
> But the error is the same.
> 
> And i don't think that there are much of differences in injection  
> lifecycle there 🙂

---

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [April 26, 2012, 10:58am UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/9 "2012-04-26T10:58:54Z")

</div>

Hello, Shay

Trying in this way:

@Inject public PreorderSortScriptFactory(Injector injector) {  
super();  
logger.info("" + injector);  
}

but as result ES even not starts – java process silently dies.

Here is what i see from log

[2012-04-26 10:57:14,227][INFO][node] [Williams,  
Simon] {0.19.2}[7659]: initializing ...

[2012-04-26 10:57:14,236][INFO][plugins] [Williams,  
Simon] loaded [Pre-Ordered Sorting], sites

[2012-04-26 10:57:16,512][INFO][node] [Bounty Hunter]  
{0.19.2}[7659]: initializing ...  
[2012-04-26 10:57:16,513][INFO][plugins] [Bounty Hunter]  
loaded [Pre-Ordered Sorting], sites

--  
Voituk Vadim  
[vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)  
SkypeID: voituk

On Wed, Apr 25, 2012 at 17:54, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Yea, I see why it happens... . Try and do the (not as nice solution) of  
> injecting the factory with Injector and keep it in a field. And then, on  
> newScript called on the factor, call: injector.getInstance(Client.class) to  
> get the client.
> 
> On Mon, Apr 23, 2012 at 3:44 PM, Vadim Voituk [vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)wrote:
> 
> > Hello, Alex,
> > 
> > On Monday, April 23, 2012 12:49:41 PM UTC+2, Alex Vasilenko wrote:
> > 
> > > Vadim,
> > > 
> > > Looks like you encountered circular dependencies. Have you tried  
> > > injecting via setter?
> > 
> > Yeah, ai've tried in this way too:
> > 
> > @Inject public void setClient(Client client) { ... }
> > 
> > But the error is the same.
> > 
> > And i don't think that there are much of differences in injection  
> > lifecycle there 🙂

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 27, 2012, 10:22am UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/10 "2012-04-27T10:22:59Z")

</div>

I;ve ran a simpel test with injecting the Injector, and it seems to  
work..., maybe you can share your code and I can have a look?

On Thu, Apr 26, 2012 at 1:58 PM, Vadim Voituk [vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)wrote:

> Hello, Shay
> 
> Trying in this way:
> 
> @Inject public PreorderSortScriptFactory(Injector injector) {  
> super();  
> logger.info("" + injector);  
> }
> 
> but as result ES even not starts – java process silently dies.
> 
> Here is what i see from log
> 
> [2012-04-26 10:57:14,227][INFO][node] [Williams,  
> Simon] {0.19.2}[7659]: initializing ...
> 
> [2012-04-26 10:57:14,236][INFO][plugins] [Williams,  
> Simon] loaded [Pre-Ordered Sorting], sites
> 
> [2012-04-26 10:57:16,512][INFO][node] [Bounty  
> Hunter] {0.19.2}[7659]: initializing ...  
> [2012-04-26 10:57:16,513][INFO][plugins] [Bounty  
> Hunter] loaded [Pre-Ordered Sorting], sites
> 
> --  
> Voituk Vadim  
> [vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)  
> SkypeID: voituk
> 
> On Wed, Apr 25, 2012 at 17:54, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Yea, I see why it happens... . Try and do the (not as nice solution) of  
> > injecting the factory with Injector and keep it in a field. And then, on  
> > newScript called on the factor, call: injector.getInstance(Client.class) to  
> > get the client.
> > 
> > On Mon, Apr 23, 2012 at 3:44 PM, Vadim Voituk [vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)wrote:
> > 
> > > Hello, Alex,
> > > 
> > > On Monday, April 23, 2012 12:49:41 PM UTC+2, Alex Vasilenko wrote:
> > > 
> > > > Vadim,
> > > > 
> > > > Looks like you encountered circular dependencies. Have you tried  
> > > > injecting via setter?
> > > 
> > > Yeah, ai've tried in this way too:
> > > 
> > > @Inject public void setClient(Client client) { ... }
> > > 
> > > But the error is the same.
> > > 
> > > And i don't think that there are much of differences in injection  
> > > lifecycle there 🙂

---

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [April 30, 2012, 7:54am UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/11 "2012-04-30T07:54:40Z")

</div>

Hello, Shay

The code is pretty straightforward:

public class PreorderSortScriptFactory implements NativeScriptFactory {

private static final ESLogger logger =  
Loggers.getLogger("com.voituk.PreorderSort");

private Injector injector;  
@Inject  
public PreorderSortScriptFactory(Injector injector) {  
super();  
this.injector = injector;  
}

@Override  
public ExecutableScript newScript(Map\<String, Object\> params) {  
super();  
logger.info("" + injector);

}

}

I'm using ES 0.19.2 on Debian with 4Gb specified as ES\_HEAP\_SIZE variable.  
And the most strange thing that i can't see any exception or something like  
that even in debug mode, so probably it's some kind of internal exception  
happens that crashes JVM silently.

Anyway, i've managed the initial problem by creating separate client node  
in this way:

Node node = NodeBuilder.nodeBuilder().client(true).node();

But it would be nice to to solve this in a right way - via @Injection.

Thanks.

On Friday, April 27, 2012 12:22:59 PM UTC+2, kimchy wrote:

> I;ve ran a simpel test with injecting the Injector, and it seems to  
> work..., maybe you can share your code and I can have a look?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 1, 2012, 2:53pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/12 "2012-05-01T14:53:57Z")

</div>

Thats what I run and it works. If you can share a full project I can have a  
look why it fails.

On Mon, Apr 30, 2012 at 10:54 AM, Vadim Voituk [vadim.voituk@gmail.com](mailto:vadim.voituk@gmail.com)wrote:

> Hello, Shay
> 
> The code is pretty straightforward:
> 
> public class PreorderSortScriptFactory implements NativeScriptFactory {
> 
> private static final ESLogger logger =  
> Loggers.getLogger("com.voituk.PreorderSort");
> 
> private Injector injector;  
> @Inject  
> public PreorderSortScriptFactory(Injector injector) {  
> super();  
> this.injector = injector;  
> }
> 
> @Override  
> public ExecutableScript newScript(Map\<String, Object\> params) {  
> super();  
> logger.info("" + injector);
> 
> }
> 
> }
> 
> I'm using ES 0.19.2 on Debian with 4Gb specified as ES\_HEAP\_SIZE variable.  
> And the most strange thing that i can't see any exception or something  
> like that even in debug mode, so probably it's some kind of internal  
> exception happens that crashes JVM silently.
> 
> Anyway, i've managed the initial problem by creating separate client node  
> in this way:
> 
> Node node = NodeBuilder.nodeBuilder().client(true).node();
> 
> But it would be nice to to solve this in a right way - via @Injection.
> 
> Thanks.
> 
> On Friday, April 27, 2012 12:22:59 PM UTC+2, kimchy wrote:
> 
> > I;ve ran a simpel test with injecting the Injector, and it seems to  
> > work..., maybe you can share your code and I can have a look?

---

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [May 1, 2012, 4:59pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/13 "2012-05-01T16:59:03Z")

</div>

Hello,

Will try to make empty project with this code only and see if it'll crash.

Will keep you updated.

Thanks,

Thats what I run and it works. If you can share a full project I can have a

> look why it fails.
> 
> Hello, Shay
> 
> > The code is pretty straightforward:
> > 
> > public class PreorderSortScriptFactory implements NativeScriptFactory {
> > 
> > private static final ESLogger logger =  
> > Loggers.getLogger("com.voituk.PreorderSort");
> > 
> > private Injector injector;  
> > @Inject  
> > public PreorderSortScriptFactory(Injector injector) {  
> > super();  
> > this.injector = injector;  
> > }
> > 
> > @Override  
> > public ExecutableScript newScript(Map\<String, Object\> params) {  
> > super();  
> > logger.info("" + injector);
> > 
> > }
> > 
> > }
> > 
> > I'm using ES 0.19.2 on Debian with 4Gb specified as ES\_HEAP\_SIZE variable.  
> > And the most strange thing that i can't see any exception or something  
> > like that even in debug mode, so probably it's some kind of internal  
> > exception happens that crashes JVM silently.
> > 
> > Anyway, i've managed the initial problem by creating separate client node  
> > in this way:
> > 
> > Node node = NodeBuilder.nodeBuilder().client(true).node();
> > 
> > But it would be nice to to solve this in a right way - via @Injection.
> > 
> > Thanks.
> > 
> > On Friday, April 27, 2012 12:22:59 PM UTC+2, kimchy wrote:
> > 
> > > I;ve ran a simpel test with injecting the Injector, and it seems to  
> > > work..., maybe you can share your code and I can have a look?

---

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [May 7, 2012, 2:06pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/14 "2012-05-07T14:06:28Z")

</div>

Hello, Shay

Here is entire project code  
[https://github.com/voituk/elasticsearch-test-plugin](https://github.com/voituk/elasticsearch-test-plugin)

and that's what i see in log  
[2012-05-07 13:57:06,944][INFO][node] [Sludge]  
{0.19.3}[19516]: stopping ...  
[2012-05-07 13:57:08,105][INFO][node] [Sludge]  
{0.19.3}[19516]: stopped  
[2012-05-07 13:57:08,105][INFO][node] [Sludge]  
{0.19.3}[19516]: closing ...  
[2012-05-07 13:57:08,177][INFO][node] [Sludge]  
{0.19.3}[19516]: closed  
[2012-05-07 13:57:13,942][INFO][node] [Cobra]  
{0.19.3}[23642]: initializing ...  
[2012-05-07 13:57:13,952][INFO][plugins] [Cobra] loaded  
[Test Plugin], sites

And nothing after that, and no even java process running.

> java -version  
> java version "1.6.0\_26"  
> Java(TM) SE Runtime Environment (build 1.6.0\_26-b03)  
> Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

Here is now the ES is started (but don't think that it matters in this  
case):  
/usr/lib/jvm/java-6-sun/bin/java -Xms1g -Xmx1g -Xss256k -XX:+UseParNewGC  
-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75  
-XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError  
-Delasticsearch -Des.pidfile=/var/run/elasticsearch.pid  
-Des.path.home=/usr/share/elasticsearch -cp  
:/usr/share/elasticsearch/lib/_:/usr/share/elasticsearch/lib/sigar/_  
-Des.config=/etc/elasticsearch/elasticsearch.yml  
-Des.path.home=/usr/share/elasticsearch  
-Des.path.logs=/var/log/elasticsearch -Des.path.data=/var/lib/elasticsearch  
-Des.path.work=/tmp/elasticsearch -Des.path.conf=/etc/elasticsearch  
org.elasticsearch.bootstrap.Elasticsearch

---

<div class="post-metadata">

**Author:** ![Vadim\_Voituk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadim_voituk/32/2841_2.png) [@Vadim\_Voituk](https://discuss.elastic.co/u/Vadim_Voituk)\
**Post date:** [May 7, 2012, 3:36pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/15 "2012-05-07T15:36:38Z")

</div>

Hmm,

I've just removed everything not related to the problem described, and it  
works fine.  
So definitely it's not an Elasticsearch but my project setup problem.

Sorry for disturbing.

On Monday, May 7, 2012 4:06:28 PM UTC+2, Vadim Voituk wrote:

> Hello, Shay
> 
> Here is entire project code  
> [https://github.com/voituk/elasticsearch-test-plugin](https://github.com/voituk/elasticsearch-test-plugin)
> 
> and that's what i see in log  
> [2012-05-07 13:57:06,944][INFO][node] [Sludge]  
> {0.19.3}[19516]: stopping ...  
> [2012-05-07 13:57:08,105][INFO][node] [Sludge]  
> {0.19.3}[19516]: stopped  
> [2012-05-07 13:57:08,105][INFO][node] [Sludge]  
> {0.19.3}[19516]: closing ...  
> [2012-05-07 13:57:08,177][INFO][node] [Sludge]  
> {0.19.3}[19516]: closed  
> [2012-05-07 13:57:13,942][INFO][node] [Cobra]  
> {0.19.3}[23642]: initializing ...  
> [2012-05-07 13:57:13,952][INFO][plugins] [Cobra] loaded  
> [Test Plugin], sites
> 
> And nothing after that, and no even java process running.
> 
> > java -version  
> > java version "1.6.0\_26"  
> > Java(TM) SE Runtime Environment (build 1.6.0\_26-b03)  
> > Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
> 
> Here is now the ES is started (but don't think that it matters in this  
> case):  
> /usr/lib/jvm/java-6-sun/bin/java -Xms1g -Xmx1g -Xss256k -XX:+UseParNewGC  
> -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75  
> -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError  
> -Delasticsearch -Des.pidfile=/var/run/elasticsearch.pid  
> -Des.path.home=/usr/share/elasticsearch -cp  
> :/usr/share/elasticsearch/lib/_:/usr/share/elasticsearch/lib/sigar/_  
> -Des.config=/etc/elasticsearch/elasticsearch.yml  
> -Des.path.home=/usr/share/elasticsearch  
> -Des.path.logs=/var/log/elasticsearch -Des.path.data=/var/lib/elasticsearch  
> -Des.path.work=/tmp/elasticsearch -Des.path.conf=/etc/elasticsearch  
> org.elasticsearch.bootstrap.Elasticsearch

---

<div class="post-metadata">

**Author:** ![bdbogjoe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bdbogjoe/32/3618_2.png) [@bdbogjoe](https://discuss.elastic.co/u/bdbogjoe)\
**Post date:** [October 15, 2016, 1:00pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/16 "2016-10-15T13:00:18Z")

</div>

How to use this injection in 5.0.0 as now we don't register the factory but we return the object already created

How to inject this Injector in my plugin class ?

---

<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:** [July 5, 2017, 10:12pm UTC](https://discuss.elastic.co/t/running-es-client-inside-es-plugin/7420/17 "2017-07-05T22:12:01Z")

</div>


