elasticsearch-analysis-ik(三)
一、下载
elasticsearch-analysis-ik-8.0.0.zip
二、安装及配置
2.1 解压文件并修改名称为IK
2.2 打包KI.zip并上传到elasticsearch工程的plugin下面
/usr/local/es/es8/plugins/ik
2.3 重启elasticsearch
三、自定义分词与取消分词
1、创建文件ext.dic
vim ext.dic #里面的内容就是自定义的分词
内容如下:
博智编程
白嫖
奥力给
2、编辑stopword.dic
打开stopword.dic(里面的内容就是停止分词)
vim stopword.dic
在后面接着输入下面内容:
的
了
哦
啊
嗯
嗷
奥
3、配置分词
vim IKAnalyzer.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">ext.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords">stopword.dic</entry>
<!--用户可以在这里配置远程扩展字典 -->
<!-- <entry key="remote_ext_dict">words_location</entry> -->
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>
四、应用Dev Tools 发送数据请求
至此,IK分词器配置完成!