I'm currently working on upgrading an application to Elasticsearch 2.1.0 and ran into some problems regarding loading Elasticsearch plugins from the classpath (instead of loading them from the
In Elasticsearch 1.x and 2.0.x it has been possible to load Elasticsearch plugins from the classpath into an embedded
Node, but this feature has been removed in Elasticsearch 2.1.0 (see #13055) and it's now only possible to do this for
TransportClient via the
I'm wondering now how I could add a classpath plugin to an embedded Elasticsearch node. For the time being I "cheated" a little bit by creating a sub-class of
Node which exposes the constructor which allows passing a collection of plugin classes to be loaded on startup, but this feels kind of dirty.
The reason I can't simply use a
TransportClient in my application is, that I need realtime information about the cluster state, e. g. when nodes were added/removed, or indices were created/closed/deleted, for which I've created a
ClusterStateListener handling those Elasticsearch events and propagating them via an internal
EventBus to my application. As far as I see, using a
TransportClient I would need to actively poll for that information in a certain interval, which would of course also increase load on the Elasticsearch cluster. Additionally, using a client node should be more efficient when indexing large amounts of documents because it knows about the cluster topology (which could be done with the
TransportClient too, when "sniff" mode is activated – but also only with a delay).
The question is: Is there another way to load plugins into an embedded Elasticsearch node from the classpath except for the "dirty" way I described above?