- 导入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
- 从maven中查看版本和本地是否一致,这里显示版本为7.9.3,我本地的版本为6.2.4

- 修改默认版本,
ctrl单击spring-boot-starter-parent,

ctrl单击spring-boot-dependencies

在properties中找到es的版本,然后复制

最后粘贴到自己的properties中,然后修改成需要的版本号,当然了,前几步可以跳过直接进行这一步

验证结果,修改成功

本文介绍了如何在Spring Boot项目中管理和更新Elasticsearch的依赖版本。通过添加spring-boot-starter-data-elasticsearch依赖,注意到Maven中央库与本地版本不一致,分别为7.9.3和6.2.4。为了同步版本,可以直接修改项目中的spring-boot-starter-parent和spring-boot-dependencies的父pom文件中的Elasticsearch版本,然后在项目properties文件中更新并设定所需版本。验证结果显示版本修改成功。
5680





