elasticsearch--RestClient操作索引库(java)

参考:https://blog.csdn.net/CYK_byte/article/details/133255773

java pom依赖:

xml 复制代码
      <!-- https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-client -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>7.17.22</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-high-level-client -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.17.22</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.14</version>
        </dependency>

<!--        &lt;!&ndash; 添加Elasticsearch Core的依赖 &ndash;&gt;-->
<!--        <dependency>-->
<!--            <groupId>org.elasticsearch</groupId>-->
<!--            <artifactId>elasticsearch</artifactId>-->
<!--            <version>7.17.22</version>-->
<!--        </dependency>-->

<!--        &lt;!&ndash; https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-elasticsearch &ndash;&gt;-->
<!--        <dependency>-->
<!--            <groupId>org.springframework.boot</groupId>-->
<!--            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>-->
<!--            <version>3.2.5</version>-->
<!--        </dependency>-->

初始化 RestHighLevelClient

这里我们创建一个测试类 HotelIndexTest ,用来演示 RestClient 操作的相关方法.

相关推荐
通往曙光的路上5 小时前
mysql1
java
Tigshop开源商城9 小时前
『物流设置+SEO优化』Tigshop开源商城系统 JAVA v5.8.26 版本更新!
java·开源商城系统·tigshop
Tigshop开源商城11 小时前
『订单税率+收货地址校验国家字段』功能上新|跨境运营更高效,Tigshop开源商城系统 JAVA v5.8.23 版本更新
java·开源商城系统·tigshop
REDcker11 小时前
C++变量存储与ELF段布局详解 从const全局到rodata与nm_readelf验证实践
java·c++·面试
kobesdu13 小时前
【ROS2实战笔记-19】ROS2 生命周期节点的启动顺序、状态转换陷阱与热备方案
java·前端·笔记·机器人·ros·ros2
neo_Ggx2313 小时前
Maven 版本管理详解:SNAPSHOT、Release 与 Nexus 仓库的区别和影响
java·maven
matlabgoodboy13 小时前
软件开发定制小程序APP帮代做java代码代编写C语言设计python编程
java·c语言·小程序
江离w13 小时前
新版vibecoding项目初始化指令
java
tongluowan00713 小时前
Spring MVC 底层工作流程+源码分析
java·spring·mvc
java1234_小锋14 小时前
SpringBoot为什么要禁止循环依赖?
java·数据库·spring boot