spring boot 2.14版本不支持 elasticsearch transportClient
spring boot 2.1.4 不支持
@Bean
public TransportClient getTransportClient() throws Exception {
Settings esSettings = Settings.builder()
.put("cluster.name", "canales")//集群名字
.put("client.transport.sniff", false)//增加嗅探机制,找到ES集群
.build();
transportClient = new PreBuiltTransportClient(esSettings);
transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName(host),Integer.valueOf(port)));
logger.info("canales transportClient 连接成功");
return transportClient;
}
目前是 1.5.6
解决: