我正在尝试使用具有低级别客户端和高级客户端的最新版本的Elasticsearch配置Spring Boot应用程序吗?有人可以建议我采取步骤吗?
我已经厌倦了不同的方式,但是它说: 2019-07-29 13:24:13.148 INFO 7716 --- [] [generic] [T#4]] oectTransportClientNodesService:无法获取{#transport#-1} {sqCZNcXuT2aA3-Klz2yaJg} {127.0的本地群集状态.0.1} {127.0.0.1:9300},正在断开连接...
org.elasticsearch.transport.NodeDisconnectedException:[] [127.0.0.1:9300] [cluster:monitor / state]已断开
公共类ElasticsearchConfiguration {
@Bean
public Client client() throws UnknownHostException {
Settings settings = Settings.builder()
.put("client.transport.sniff", true)
.put("cluster.name", "elasticSearch").build();
@SuppressWarnings({ "resource", "deprecation" })
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new
TransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
return client;
}
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws
UnknownHostException {
return new ElasticsearchTemplate(client());
}
}
它说9300上已添加了传输地址,但显示为断开连接。