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 操作的相关方法.

相关推荐
chxii3 小时前
5java集合框架
java·开发语言
yychen_java3 小时前
R-tree详解
java·算法·r-tree
JANYI20184 小时前
嵌入式设计模式基础--C语言的继承封装与多态
java·c语言·设计模式
xrkhy4 小时前
反射, 注解, 动态代理
java
Ten peaches4 小时前
Selenium-Java版(操作元素)
java·selenium·测试工具·html
lyw2056195 小时前
RabbitMQ,Kafka八股(自用笔记)
java
邹诗钰-电子信息工程5 小时前
嵌入式自学第二十一天(5.14)
java·开发语言·算法
有梦想的攻城狮5 小时前
spring中的@MapperScan注解详解
java·后端·spring·mapperscan
寒小松5 小时前
Problem E: List练习
java·数据结构·list
zimoyin5 小时前
Kotlin 协程实战:实现异步值加载委托,对值进行异步懒初始化
java·前端·kotlin