springboot集成elasitcsearch
安装elasticsearch
安装kibana
- 下载kibana版本与es版本一致
- 下载之后也解压到相关目录

- 运行kibana 启动之后默认地址 http:localhost:5601

- 访问kinaba
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CWIsWKm1-1648273875075)(README.assets/image-20201217110259570.png)]](https://i-blog.csdnimg.cn/blog_migrate/26e5b9919733907a939cc282751567ea.png)
- 访问之后默认是英文的 然后进行汉化
- 修改config目录下的kibana.yml配置文件 最后一行添加
i18n.locale: "zh-CN

- 修改配置文件之后重启kinaba
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-uwjKxzVj-1648273875075)(README.assets/image-20201217110733009.png)]](https://i-blog.csdnimg.cn/blog_migrate/8fb2e31cd686e2a07f230d1947d3d0d5.png)
配置ik分词器插件
kinaba使用

# 添加数据 修改数据(修改数据)
put /kcloud/_doc/2
{
"name":"zs",
"title":"张三",
"age":19,
"created":"2018-12-25"
}
# 删除索引
DELETE kcloud
# 查询索引信息
GET test_es
# 创建索引 并创建field的数据结构
PUT /test_es
{
"mappings": {
"_doc": {
"properties": {
"name": { "type": "text" },
"age": { "type": "integer" },
"createdAt": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"updatedAt": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"deleted": { "type": "boolean" }
}
}
}
}
# 查询索引test_es —doc类型(7.X以后不推荐使用,8.x取消) id为4的数据记录
GET /test_es/_doc/4
PUT /test_es/_doc/3
{
"name":"张三-46542634",
"age":12
}
# 获取分词结果
GET _analyze
{
"analyzer" : "ik_smart",
"text" : "床前明月光"
}
# 采用ik分词器的 最小划分粒度
GET _analyze
{
"analyzer" : "ik_max_word",
"text" : "床前明月光"
}
# ik分词最大划分粒度
GET _analyze
{
"analyzer" : "ik_max_word",
"text" : "中国"
}
springboot 2.3.2集成es 6.7.2
一、添加依赖
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.7.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>6.7.2</version>
</dependency>
二、配置

三、java restapi操作es
