原生依赖
代码语言:html复制<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.8.1</version>
</dependency>
初始化对象
代码语言:java复制RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(
new HttpHost("localhost", 9200, "http"),
new HttpHost("localhost", 9201, "http")));
代码语言:java复制client.close();
然后分析这个对象中的方法即可(api)
创建项目
这里以https://start.spring.io/的方式进行创建