# TransportClient & Plugin Registration?

**URL:** <https://discuss.elastic.co/t/transportclient-plugin-registration/10503>\
**Category:** Elasticsearch\
**Created:** [January 25, 2013, 8:28am UTC](https://discuss.elastic.co/t/transportclient-plugin-registration/10503 "2013-01-25T08:28:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [January 25, 2013, 8:28am UTC](https://discuss.elastic.co/t/transportclient-plugin-registration/10503/1 "2013-01-25T08:28:20Z")

</div>

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](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/](https://github.com/zenobase/geocluster-facet/)

--

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [January 25, 2013, 8:33am UTC](https://discuss.elastic.co/t/transportclient-plugin-registration/10503/2 "2013-01-25T08:33:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 25, 2013, 8:59am UTC](https://discuss.elastic.co/t/transportclient-plugin-registration/10503/3 "2013-01-25T08:59:39Z")

</div>

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](https://github.com/spinscale/elasticsearch-suggest-plugin)  
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](https://github.com/spinscale/elasticsearch-suggest-plugin/issues/4#issuecomment-9108240)  
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](https://github.com/spinscale/elasticsearch-suggest-plugin/commit/6077084db6eb064233b09903c4e10df86ef978df)

HTH  
David

Le 25 janv. 2013 à 09:28, Eric Jain [eric.jain@gmail.com](mailto: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](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](https://github.com/zenobase/geocluster-facet/)
> 
> --

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [January 25, 2013, 9:52am UTC](https://discuss.elastic.co/t/transportclient-plugin-registration/10503/4 "2013-01-25T09:52:58Z")

</div>

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

> <https://github.com/zenobase/geocluster-facet/blob/master/src/main/java/com/zenobase/search/facet/geocluster/GeoClusterFacetPlugin.java>

```
 @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

--

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [January 25, 2013, 11:33pm UTC](https://discuss.elastic.co/t/transportclient-plugin-registration/10503/5 "2013-01-25T23:33:34Z")

</div>

On Fri, Jan 25, 2013 at 1:52 AM, Jörg Prante [joergprante@gmail.com](mailto: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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:54am UTC](https://discuss.elastic.co/t/transportclient-plugin-registration/10503/6 "2017-07-06T02:54:33Z")

</div>


