以上报错本质涉及:Springboot2.x.x中elasticsearch的版本号对应关系
在springboot 的pom中 parent.version 版本号为 <version>2.1.7.RELEASE</version>,此时
spring:
data:
elasticsearch: repositories: enabled: true cluster-nodes: es:9300
以上配置elasticsearch项目可以运行。但凡已经出现cluster-nodes与cluster-name 已经出现中斜杠被deprecate了,就要考虑springboot的版本号问题,我之前用的是 <version>2.2.6.RELEASE</version> 就是有问题的,另外此时的elasticsearch的版本是6.4.0。
elasticsearch的版本号在7.x.x后的springboot里的yml配置就要改为以下
elasticsearch:
rest:
uris: http://ip地址:9200
配置才行。