前言:
elasticsearch的版本是:7.4.2 springboot的版本:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
配置文件:
spring:
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 192.168.8.132:9300
repositories:
enabled: true
- 启动、运行
- 启动时:failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{PD06vWIWQsi0zp2VpFBesQ}{192.168.8.132}{192.168.8.132:9300}]
访问es时:org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{PD06vWIWQsi0zp2VpFBesQ}{192.168.8.132}{192.168.8.132:9300}] 各种百度给出做好的解决办法是:当es版本大于7时,建议使用高级客户端: RestHighLevelClient 下面开始整合高级客户端(明天写):
|