没有合适的资源?快使用搜索试试~ 我知道了~
SpringBoot整合Elasticsearch7.2.0的实现方法
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
4星 · 超过85%的资源 26 下载量 142 浏览量
2020-08-25
17:13:01
上传
评论 1
收藏 58KB PDF 举报
温馨提示
试读
3页
主要介绍了SpringBoot整合Elasticsearch7.2.0的实现方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
资源推荐
资源详情
资源评论
SpringBoot整合整合Elasticsearch7.2.0的实现方法的实现方法
主要介绍了SpringBoot整合Elasticsearch7.2.0的实现方法,文中通过示例代码介绍的非常详细,对大家的学习或
者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
Spring boot 2.1.X整合Elasticsearch最新版的一处问题
新版本的Spring boot 2的spring-boot-starter-data-elasticsearch中支持的Elasticsearch版本是2.X,但Elasticsearch实际上已经
发展到7.2.X版本了,为了更好的使用Elasticsearch的新特性,所以弃用了spring-boot-starter-data-elasticsearch依赖,而改为
直接使用Spring-data-elasticsearch,以便启用对新版本支持,目前的版本对应关系如下
Elasticsearch(ES)有两种连接方式:transport、rest。transport通过TCP方式访问ES(只支持java),rest方式通过http
API 访问ES(没有语言限制)。
ES官方建议使用rest方式, transport 在7.0版本中不建议使用,在8.X的版本中废弃。
引入依赖:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
application.yml配置:
elasticsearch:
ip: 192.168.52.132:9200
客户端连接配置类
package com.dc.elastic.configuration;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
import java.util.Objects;
资源评论
- √√√√√_文2022-01-18不如不下。。
- sinat_288792432023-08-01非常有用的资源,可以直接使用,对我很有用,果断支持!
- xzl@84212023-11-09资源质量不错,和资源描述一致,内容详细,对我很有用。
weixin_38720256
- 粉丝: 4
- 资源: 947
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C#中.net8WebApi加密解密
- 大二用到的unity素材
- 传输丢包导致VONR通话断续处理案例.docx
- 1.5数据透视进阶:切片器关联与二次计算
- 1.6 可视化入门:各类基础图表全实操
- 深度剖析C编程 初级+中级+高级 基础+数据结构源码+组成原理+操作系统及C语言高级
- HM深度技术剖析 JAVA Web全新维度 最新JAVA Web全面开发课程 最新技术与综合实战课程
- 3000多集 5门计算机考研课程全面升级 C语言+数据结构+组成原理+计算机网络+操作系统
- 系统级别的专业晋级之途 嵌入式工程师Linux系统编程深度培训与自我进阶企业级实战
- 41小时全新华为HCIA-datacom认证课程 数据通信的深度探索 华为数据通信深度探索
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功