I'm trying to include the Java Transport Client in my webapp for enriching its searching functionalities by Elasticsearch integration.
I have installed Elasticsearch version 5.3.2 on my laptop and I have added the following dependency in the pom of my webapp:
<dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>transport</artifactId> <version>5.3.2</version> </dependency>
The issues is that the transport client depends on Lucene (version 6.4.2) and in my webapp we already embed Lucene (version 3.6.0) which cannot be upgraded.
I have tried to exclude Lucene dependencies but then I get errors (due to Lucene classes not found) when I try to instatiate the client:
Settings settings = Settings.builder().put("cluster.name", "mycluster")
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
List clusterDiscoveredNodes = client.connectedNodes();
My question is: since we're a speaking of a "transport" client, why we need to included also Lucene?
Is there a way of using the transport client without including Lucene dependencies?
If not, the best solution is to use the lighter rest client?