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...
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?
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 ...
Tried proxying org.elasticsearch.script.ScriptService to support a
circular dependency, but it is not an interface."
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 ...
Tried proxying org.elasticsearch.script.ScriptService to support a
circular dependency, but it is not an interface."
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:
Tried proxying org.elasticsearch.script.ScriptService to support a
circular dependency, but it is not an interface.
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) {
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:
Tried proxying org.elasticsearch.script.ScriptService to support a
circular dependency, but it is not an interface.
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) {
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 Wed, Apr 25, 2012 at 17:54, Shay Banon 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 Wed, Apr 25, 2012 at 17:54, Shay Banon 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.
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:
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:
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:
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
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:
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
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.