Is any Java client V7 working with ES V8?

Hello,
I'm trying to make upgrade from ES V6 to V8. Unfortunately I have to use Java 8 only (on client side). I found out that compatible (it means supported) Java 8 client (TransportClient) for ES V8 is also V7.17.6.
I wrote simple client with index existence check:

public static void main(String[] args) throws IOException {
    Settings settings = Settings.builder()
                    .put("cluster.name", "elasticsearch")
                    .put("client.transport.sniff", true)
                    .build();

    TransportClient client = new PreBuiltTransportClient(settings);
    client.addTransportAddress(new TransportAddress(InetAddress.getByName(localhost), 9300));

    AliasesExistResponse response = client.admin().indices().prepareAliasesExist("test_alias").get();
    boolean indexExists = response.exists();
        

However when I run this code I got this exception:

Exception in thread "main" ActionNotFoundTransportException[No handler for action [indices:admin/aliases/exists]]
	at org.elasticsearch.transport.InboundAggregator.lambda$new$0(InboundAggregator.java:47)
	at org.elasticsearch.transport.InboundAggregator.initializeRequestState(InboundAggregator.java:197)
	at org.elasticsearch.transport.InboundAggregator.headerReceived(InboundAggregator.java:66)
	at org.elasticsearch.transport.InboundPipeline.forwardFragments(InboundPipeline.java:138)
	at org.elasticsearch.transport.InboundPipeline.doHandleBytes(InboundPipeline.java:121)
	at org.elasticsearch.transport.InboundPipeline.handleBytes(InboundPipeline.java:86)
	at org.elasticsearch.transport.netty4.Netty4MessageInboundHandler.channelRead(Netty4MessageInboundHandler.java:63)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:623)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:586)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.lang.Thread.run(Thread.java:833)

I read that deprecated TransportClient V7.17.X is not fully compatible with ES 8 and this is reason of given exception. Is any solution for Java client using Java 8 and working with ES V8? E.g. new Java Client type...

The new Java Client is Java8 compatible. You should use this one.

Do you mean High Level Rest Client version 7.17 or Elasticsearch Java API Client 8.4?

I mean the later. It is designed for Elastic 8 and comes with less dependencies.

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