Are the mapper attachment plugin and the IndicesService class compatible with a TransportClient?


I've been using ElasticSearch 2.1 and the Java API for a few weeks now and it went fine so far. I'm now trying to use the mapper attachment plugin to index the content of some files. I browsed the ES repository and looked at the test classes. I found one that suits my needs: elasticsearch/core/src/test/java/org/elasticsearch/index/mapper/simple/ (branch 2.1) but I haven't been able to make it work with a TransportClient.

My problem stands with this unique line that every test case starts with:

IndexService indexService = createIndex("test");

The createIndex() method refers to this class elasticsearch/core/src/test/java/org/elasticsearch/test/ which uses a Node client.

I may not exactly understand what the IndexService class stands for and I apologize if my question is oblivious but here it is.

Can a TransportClient have the same kind of access to the IndicesService as the Node Client? If so, could you tell me how? If not, is there any class other than IndicesService/IndexService I could use to get a proper DocumentMapperParser in case of a TransportNode? Any enlightenment would be appreciated.

Thank you!

Maybe some quick notes.

The design of ES code is a little bit mixed up. Client code and server-only code depend on each other. Because of this, services which are server-only, like IndexService, live side by side with services which can be used by a NodeClient, or a TransportClient.

IndexService provides methods for maintaining index data, which is kept in data nodes, and is never at client side, i.e. NodeClient, or a TransportClient.

You have to study the code to learn more about the modules and services. They are instantiated by injection (a guice-like ModuleBuilder) and you will notice that a server-side node will ramp up much more services, including cluster management, index analysis, and so on, while clients only instantiate network services, and thread pools.

In a TransportClient, you will not have access to cluster state, or indices.

Regarding the mapper attachment plugin, it lives on server-side only, and can not be used by a TransportClient.