SpringBoot整合ElasticSearch遇到的连接问题

解决SpringBoot与ES版本冲突
本文详细介绍了在使用SpringBoot2.2.0与ES5.5版本时遇到的NoNodeAvailableException错误,通过调整SpringBoot版本至2.0.0解决了与Spring-data-elasticsearch的版本不适配问题。

failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{4J2eCGFXSZmM3xH72WIF5A}{192.168.252.200}{192.168.252.200:9300}]

我再使用SpringBoot2.2.0,ES版本5.5时,Spring-boot-data-elasticsearch开发整合启动出现上面的错误。

一开始以为是es节点名称或者ip端口写错了,但是看了半天也没有问题,浏览器也可以直接访问es集群。

之后去Spring文档中查看,发现SpringBoot对Spring-boot-data-elasticsearch的版本进行了讲解

 

发现SpringBoot2.1.x使用的spring data es是3.1.x适配es6.x

而SpringBoot2.0.x使用3.0.x适配ES5.x

SpringBoot1.5.x就只能使用ES2.4.x的版本了

然后我把SpringBoot版本改为2.0.0之后成功启动没报错,并成功访问

可以看到,正如文档所说,SpringBoot2.0.0使用的Spring-data-elasticsearch是3.0.5的版本,即对于es5.x的版本

正确访问接口

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值