TransportClient & Plugin Registration?

I have a facet plugin [1] that works as expected when used from
applications that use the NodeClient to connect, but that fails with a
NullPointerException at
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/InternalFacets.java#L143
in applications that use the TransportClient.

I'm guessing that the NodeClient scans the classpath for plugins and
registers them, but the TransportClient doesn't? Or what am I missing?

[1] https://github.com/zenobase/geocluster-facet/

--

Forgot to add: This is with a recent version of elasticsearch, 0.20.1.

Hi Eric,

I think that Alexander had the same issue some months ago when he was working on its suggest plugin: GitHub - spinscale/elasticsearch-suggest-plugin: Plugin for elasticsearch which uses the lucene FSTSuggester
May be you can have a look at its sources and see how he solved that: Publish artifact in maven repo · Issue #4 · spinscale/elasticsearch-suggest-plugin · GitHub
I think it's relative to this commit: Ensuring fst modules/services are not loaded in a transport client en… · spinscale/elasticsearch-suggest-plugin@6077084 · GitHub

HTH
David

Le 25 janv. 2013 à 09:28, Eric Jain eric.jain@gmail.com a écrit :

I have a facet plugin [1] that works as expected when used from applications that use the NodeClient to connect, but that fails with a NullPointerException at https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/InternalFacets.java#L143 in applications that use the TransportClient.

I'm guessing that the NodeClient scans the classpath for plugins and registers them, but the TransportClient doesn't? Or what am I missing?

[1] GitHub - zenobase/geocluster-facet

--

Hi,

search function implementations are not directly available in a
TransportClient. There is a transport search module, and a transport
facet module instead, which can only "transport" search/facets to the
real search/facet module on the cluster (remote access).

So, your plugin init code at

 @Override
 public void processModule(Module module) {
     if (module instanceof FacetModule) {
         ((FacetModule) 

module).addFacetProcessor(GeoClusterFacetProcessor.class);
InternalGeoClusterFacet.registerStreams();
}
}

will only be executed on a cluster node, but not on a TransportClient.

Probably this will work better

 @Override
 public void processModule(Module module) {
     if (module instanceof FacetModule) {
         ((FacetModule) 

module).addFacetProcessor(GeoClusterFacetProcessor.class);
InternalGeoClusterFacet.registerStreams();
}
if (module instanceof TransportFacetModule) {
InternalGeoClusterFacet.registerStreams();
}
}

To give an idea of the services in Elasticsearch, the NodeClient modules are

PluginsModule
SettingsModule
NodeModule
NetworkModule
NodeCacheModule
ScriptModule
JmxModule
EnvironmentModule
NodeEnvironmentModule
ClusterNameModule
ThreadPoolModule
DiscoveryModule
ClusterModule
RestModule
TransportModule
HttpServerModule (optional)
RiversModule
IndicesModule
SearchModule (+ FacetModule)
ActionModule(false -> switch proxy mode off)
MonitorModule
GatewayModule
NodeClientModule
BulkUdpModule
ShapeModule

The TransportClient modules are

PluginsModule
EnvironmentModule
SettingsModule
NetworkModule
ClusterNameModule
ThreadPoolModule
TransportSearchModule (+TransportFacetModule)
TransportModule
ActionModule(true -> switch proxy mode on)
ClientTransportModule

Note the difference, SearchModule vs. TransportSearchModule and
FacetModule vs. TransportFacetModule.

So, in summary, in a TransportClient, these features are not availabe

  • node function impl
  • cluster admin function impl
  • node-level caching
  • scripts
  • JMX
  • monitoring JVM, OS, etc
  • Zen Discovery impl
  • REST
  • HTTP server
  • rivers
  • indices admin function impl
  • search function impl
  • gateway
  • node client function impl
  • bulk per UDP
  • geo shapes

Best regards,

Jörg

--

On Fri, Jan 25, 2013 at 1:52 AM, Jörg Prante joergprante@gmail.com wrote:

Probably this will work better

@Override
public void processModule(Module module) {
    if (module instanceof FacetModule) {
        ((FacetModule)

module).addFacetProcessor(GeoClusterFacetProcessor.class);
InternalGeoClusterFacet.registerStreams();
}
if (module instanceof TransportFacetModule) {
InternalGeoClusterFacet.registerStreams();
}
}

Thanks! I noticed that calling registerStreams anywhere from the
application fixed the problem, but wasn't sure about the proper place
to put that call.