我正在尝试将ElasticSearch与Springboot集成,但我收到以下错误:
“exception”:“org.elasticsearch.client.transport.NoNodeAvailableException”, “message”:“没有配置的节点可用:[{#transport#-1} {XXXXXXXXXXXXX.us-east-1.aws.found.io} {54.221.223.25:9243}]”,
的Maven:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
<version>1.5.9.RELEASE</version>
</dependency>
配置:
Settings esSettings = Settings.settingsBuilder()
.put("cluster.name", EsClusterName)
.build();
return TransportClient.builder()
.settings(esSettings)
.build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(EsHost), EsPort));
}
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
return new ElasticsearchTemplate(client());
}
application.properties:
elasticsearch.cluster-name=8cf2fXXXXXXXXafbdc34d3
spring.data.elasticsearch.properties.username=elastic
spring.data.elasticsearch.properties.password=xxxxxxxxxxxxxxxxxxx
spring.data.elasticsearch.properties.http.enabled=true
elasticsearch.host=xxxxxxxxxxxxx.us-east-1.aws.found.io
elasticsearch.port=9243
spring.data.elasticsearch.repositories.enabled=true
答案 0 :(得分:0)
您检查过ES服务器版本了吗? Spring boot 1.5.9.RELEASE仅适用于ES 2.
如果你有ES 5.5,你必须升级到Spring boot 2。
如果你有ES 6+,你现在就被困住了(这就是我调查的地方)。