Exception in thread "main" java.lang.IllegalStateException: Unsupported transport.type [netty4]

Am trying to connect our ES from Java App using TransportClient.

ES Version 6.1.0

POM:

<dependency>
	<groupId>org.elasticsearch</groupId>
	<artifactId>elasticsearch</artifactId>
	<version>6.1.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.elasticsearch.client/transport -->
<dependency>
	<groupId>org.elasticsearch.client</groupId>
	<artifactId>transport</artifactId>
	<version>6.2.0</version>
</dependency>

Code Snippet:

Settings settings = Settings.builder().put("cluster.name", "elasticsearch")
.put("client.transport.sniff", true).build();
TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(new TransportAddress(InetAddress.getByName(ES_HOST), ES_PORT));

Getting below Exception:

Error Trace:

Exception in thread "main" java.lang.IllegalStateException: Unsupported transport.type [netty4]
at org.elasticsearch.common.network.NetworkModule.getTransportSupplier(NetworkModule.java:210)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:176)
at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:262)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:128)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:114)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:104)

Why are you adding a dependency on elasticsearch itself? And why another version?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.