How to install plugins for embedded elasticsearch?


(Eric Jain) #1

To install a plugin into a standalone copy of elasticsearch I can do
e.g.bin\plugin -install elasticsearch/elasticsearch-cloud-aws/1.4.0.
But how does this work when running elasticsearch embedded in a Java
application? Do I simple add all the plugin jars to the classpath?


(David Pilato) #2

Yes. Just add the artifact in your pom.xml.

David :wink:
Twitter : @dadoonet / @elasticsearchfr

Le 4 avr. 2012 à 01:31, Eric Jain eric.jain@gmail.com a écrit :

To install a plugin into a standalone copy of elasticsearch I can do
e.g.bin\plugin -install elasticsearch/elasticsearch-cloud-aws/1.4.0.
But how does this work when running elasticsearch embedded in a Java
application? Do I simple add all the plugin jars to the classpath?


(Shay Banon) #3

Yes, you just need to have the plugin jars in the classpath.

On Wed, Apr 4, 2012 at 2:31 AM, Eric Jain eric.jain@gmail.com wrote:

To install a plugin into a standalone copy of elasticsearch I can do
e.g.bin\plugin -install elasticsearch/elasticsearch-cloud-aws/1.4.0.
But how does this work when running elasticsearch embedded in a Java
application? Do I simple add all the plugin jars to the classpath?


(clandestino_bgd-2) #4

Hi,
I need to install es-head plugin automatically on start of my embedded ES.
This plugin isn't get installed as jar, but as a site, if I am not mistaken?
What would be the best way to do this?
Thanks,
Milan

On Wednesday, 4 April 2012 16:07:15 UTC+1, kimchy wrote:

Yes, you just need to have the plugin jars in the classpath.

On Wed, Apr 4, 2012 at 2:31 AM, Eric Jain <eric...@gmail.com <javascript:>

wrote:

To install a plugin into a standalone copy of elasticsearch I can do
e.g.bin\plugin -install elasticsearch/elasticsearch-cloud-aws/1.4.0.
But how does this work when running elasticsearch embedded in a Java
application? Do I simple add all the plugin jars to the classpath?

--


(Jörg Prante) #5

You have two options for plugin automatic installs.

The first is most convenient, just unpack ES, install the plugins,
repackage ES, distribute it. This is also easy for later updates.

Second, if you don't want to prepackage ES with plugins (maybe due to
license issues or if the plugins to get installed are unknown at this time,
or customers shouldn't use the bin/plugin method for whatever reason), you
could try to add a function to your code. Try something like this (taken
from org.elasticsearch.plugins.PluginManager)

    Tuple<Settings, Environment> initialSettings = 

InternalSettingsPerparer.prepareSettings(EMPTY_SETTINGS, true);
if (!initialSettings.v2().pluginsFile().exists()) {
FileSystemUtils.mkdirs(initialSettings.v2().pluginsFile());
}
String url = null;
PluginManager pluginManager = new
PluginManager(initialSettings.v2(),url);
pluginManager.downloadAndExtract( "mylovely//1.0.0",
true);

Adjust 'url' to the URL where the plugin is located, or null to download
form github.

The HTTP server inside the ES node should now redirect requests to port
92xx and path /_plugin// to the site plugin files.

Note, if it is not a site plugin, the node needs a restart for plugin
initialization.

Jörg

--


(Bibin Abraham) #6

Hi Jörg,

I have embedded ES in a tomcat container to use it as a web app. I have
referenced twitter plugin and created a subclass of AbstractPlugin. Now in
the elasticsearch.yml settings, what path should I give for the plugin
directory?

Thanks & Regards

bin

On Thursday, 6 December 2012 14:09:02 UTC+5:30, Jörg Prante wrote:

You have two options for plugin automatic installs.

The first is most convenient, just unpack ES, install the plugins,
repackage ES, distribute it. This is also easy for later updates.

Second, if you don't want to prepackage ES with plugins (maybe due to
license issues or if the plugins to get installed are unknown at this time,
or customers shouldn't use the bin/plugin method for whatever reason), you
could try to add a function to your code. Try something like this (taken
from org.elasticsearch.plugins.PluginManager)

    Tuple<Settings, Environment> initialSettings = 

InternalSettingsPerparer.prepareSettings(EMPTY_SETTINGS, true);
if (!initialSettings.v2().pluginsFile().exists()) {
FileSystemUtils.mkdirs(initialSettings.v2().pluginsFile());
}
String url = null;
PluginManager pluginManager = new
PluginManager(initialSettings.v2(),url);
pluginManager.downloadAndExtract( "mylovely//1.0.0",
true);

Adjust 'url' to the URL where the plugin is located, or null to download
form github.

The HTTP server inside the ES node should now redirect requests to port
92xx and path /_plugin// to the site plugin files.

Note, if it is not a site plugin, the node needs a restart for plugin
initialization.

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #7

Not sure how you handle twitter plugin, by downloadAndExtract? Or do you
prepackage it in your war?

You do not need a plugin path at all, as long as es-plugin.properties in
the jar root of the plugin is visible in the classpath of the war where you
start the embedded node.

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alex Roytman) #8

If it is a site plugin I am not sure transport wares servlet would forward to plugins. It didn't work for me no matter how I tried to configure it. I ended up subclassing transport wares servlet and implementing all plufin forwarding logic myself

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #9