Spring boot 整合elasticsearch

编程入门 行业动态 更新时间:2024-10-28 14:26:48

<a href=https://www.elefans.com/category/jswz/34/1769862.html style=Spring boot 整合elasticsearch"/>

Spring boot 整合elasticsearch

文章目录

  • 初始化RestClient

初始化RestClient

在elasticsearch提供的API中,与elasticsearch一切交互都封装在一个名为RestHighLevelClient的类中,必须先完成这个对象的初始化,建立与elasticsearch的连接。

分为三步:

1)引入es的RestHighLevelClient依赖:

<dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId>
</dependency>

2)因为SpringBoot默认的ES版本是7.6.2,所以我们需要覆盖默认的ES版本:

<properties><java.version>1.8</java.version><elasticsearch.version>7.12.1</elasticsearch.version>
</properties>

3)初始化RestHighLevelClient:

更多推荐

Spring boot 整合elasticsearch

本文发布于:2023-11-15 01:29:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1591290.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Spring   boot   elasticsearch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!