1.导入依赖

ES - SpringBoot 集成 + ES API接口讲解_spring

 

 

2.官方调用教程

 ES - SpringBoot 集成 + ES API接口讲解_ide_02

 

 

3.IDEA配置

 

ES - SpringBoot 集成 + ES API接口讲解_ide_03

 

 

一定要保证:我们刀日德依赖,和安装的ES版本一致!!!

 

默认的版本可能和本地安装的版本不一致:

本地使用7.6.1,而springboot es starter里面使用的是6.8.7

ES - SpringBoot 集成 + ES API接口讲解_spring_04

 

 

ES - SpringBoot 集成 + ES API接口讲解_批量插入_05

 

 

ES - SpringBoot 集成 + ES API接口讲解_批量更新_06

 

 

相关的源码

ES - SpringBoot 集成 + ES API接口讲解_ide_07

 

 

 

4.API测试

4.1 ES rest client注入

ES - SpringBoot 集成 + ES API接口讲解_批量删除_08

 

 

4.2 索引indices相关API

创建索引

ES - SpringBoot 集成 + ES API接口讲解_ide_09

 

 

获取索引

ES - SpringBoot 集成 + ES API接口讲解_ide_10

 

 

删除索引

ES - SpringBoot 集成 + ES API接口讲解_ide_11

 

 

4.3 文档document相关API

添加文档

ES - SpringBoot 集成 + ES API接口讲解_ide_12

 

判断文档是否存在

ES - SpringBoot 集成 + ES API接口讲解_ide_13

 

 

获取文档

ES - SpringBoot 集成 + ES API接口讲解_spring_14

 

 

更新文档

ES - SpringBoot 集成 + ES API接口讲解_批量删除_15

 

 

删除文档

ES - SpringBoot 集成 + ES API接口讲解_批量删除_16

 

 

批量插入/批量更新/批量删除 文档

ES - SpringBoot 集成 + ES API接口讲解_批量插入_17

ES - SpringBoot 集成 + ES API接口讲解_批量插入_18

 

ES - SpringBoot 集成 + ES API接口讲解_批量删除_19

 

 

查询search

ES - SpringBoot 集成 + ES API接口讲解_spring_20

ES - SpringBoot 集成 + ES API接口讲解_spring_21