ik分词器安装和使用
下载地址:
https://github.com/medcl/elasticsearch-analysis-ik/releases
解压
elasticsearch-7.11.1/plugins
重启es

- 查看插件列表
bin/elasticsearch-plugin list
最小粒度切分
ik_smart
最细力度划分
ik_max_word
- 添加自定义字典
/app/hadoop/elasticsearch-7.11.1/plugins/ik/config/chunyu.dic
修改配置文件
/app/hadoop/elasticsearch-7.11.1/plugins/ik/config/IKAnalyzer.cfg.xml
<entry key="ext_dict">chunyu.dic</entry>
重启ES

添加索引
PUT test1/type1/1
{
"name": "狂神说2",
"age": 3
}

- 创建指定字段类型的索引
PUT /test2
{
"mappings": {
"properties": {
"name": {
"type": "text"
},
"age": {
"type": "long"
},
"birthday" :{
"type": "date"
}
}
}
}
- 获取索引
GET /test2
- 查看健康状态 GET _cat/
GET _cat/indices?v
- 索引的修改
- 直接通过PUT 请求覆盖
PUT test1/type1/1
{
"name": "狂神2",
"age": 3
}
PUT test2/_doc/2
{
"name": "王五",
"birthday": "2020-01-01"
}
- 通过POST 请求更新(推荐使用)
POST test1/type1/1/_update
{
"doc": {
"name": "法外狂徒"
}
}
POST test2/_doc/3/_update
{
"doc": {
"name": "老师"
}
}
- 删除索引
DELETE test1

浙公网安备 33010602011771号