TransportClient with plugins instantiating node services

Hi there,

I am trying to get my elasticsearch fst suggester up and running with
ES 0.19.9 - as this bug has been fixed
https://github.com/elasticsearch/elasticsearch/issues/1982 I would
like to be able to use it in a TransportClient

However this introduces another problem:
If I am adding a service in the AbstractPlugin.services() method,
which injects components not available on a transport client (like a
clusterService), loading fails obviously.

Is there any possibility to check if a plugin is loaded in a context
of a transport client or a real node? Or am I missing some other
feature I should use instead? Is there already some plugin method
instead of services() I should use?

And another little question: Where is the difference between
AbstractPlugin.modules(), AbstractPlugin.indexModules() and
AbstractPlugin.shardModules()?
Is it possible to bind own instances per node, per index and per shard?
Are there any sample plugins using these features?

--Alexander

--

Hi Alexander,

the difference between "modules", " index modules", and "shard modules" is
that "modules" are loaded by the "modules builder" (and are loaded whenever
a plugin can be loaded), an "index module" is loaded when an "indices
service" comes up (such plugins can work at index scope, with analyzer,
mapping services etc.), and "shard plugins" are coming up when a "shard
service" is initializing (such plugins can work at shard scope, for
accessing Lucene index structures for example).

Right now I can't see how a plugin can check if it's in an "expected
environment" whatever that means. They should be pre-configured by the
plugin author to get loaded by one of the services inside ES. I think it
would be a little late if ES would have to load all the plugins by wild
guesses only to find out they are loaded at the wrong place where they
can't proceed.

For a TransportClient environment, I understand that a generic "module" is
the right module type to choose, since there is no index, no analyzer, no
mapping service, and no shard around. In my view, such plugins are somehow
restricted in their capabilities, since they could only work on local data
processing (content filtering, query builder manipulation), but they have
to fetch the ES configuration they probably need for such tasks from the
cluster (mappings and cluster and nodes info for example).

Best regards,

Jörg

On Thursday, September 27, 2012 11:34:32 PM UTC+2, Alexander Reelsen wrote:

Hi there,

I am trying to get my elasticsearch fst suggester up and running with
ES 0.19.9 - as this bug has been fixed
TransportClient does not load plugins · Issue #1982 · elastic/elasticsearch · GitHub I would
like to be able to use it in a TransportClient

However this introduces another problem:
If I am adding a service in the AbstractPlugin.services() method,
which injects components not available on a transport client (like a
clusterService), loading fails obviously.

Is there any possibility to check if a plugin is loaded in a context
of a transport client or a real node? Or am I missing some other
feature I should use instead? Is there already some plugin method
instead of services() I should use?

And another little question: Where is the difference between
AbstractPlugin.modules(), AbstractPlugin.indexModules() and
AbstractPlugin.shardModules()?
Is it possible to bind own instances per node, per index and per shard?
Are there any sample plugins using these features?

--Alexander

--

You should be able to check in your plugin for the "node.client" setting, and if its set to true, then don't create the mentioned service.

On Sep 27, 2012, at 11:34 PM, Alexander Reelsen alr@spinscale.de wrote:

Hi there,

I am trying to get my elasticsearch fst suggester up and running with
ES 0.19.9 - as this bug has been fixed
TransportClient does not load plugins · Issue #1982 · elastic/elasticsearch · GitHub I would
like to be able to use it in a TransportClient

However this introduces another problem:
If I am adding a service in the AbstractPlugin.services() method,
which injects components not available on a transport client (like a
clusterService), loading fails obviously.

Is there any possibility to check if a plugin is loaded in a context
of a transport client or a real node? Or am I missing some other
feature I should use instead? Is there already some plugin method
instead of services() I should use?

And another little question: Where is the difference between
AbstractPlugin.modules(), AbstractPlugin.indexModules() and
AbstractPlugin.shardModules()?
Is it possible to bind own instances per node, per index and per shard?
Are there any sample plugins using these features?

--Alexander

--

--