Elasticsearch IK分词器
安装
什么是IK分词器
把一个中文或者英文识别成关键字。
分词算法
- ik_smart
最少切分
- ik_max_word
最细粒度划分,穷尽词库的可能。
分词算法测试
1 | GET _analyze |
发现问题:有的词不希望被拆开:
这种需要自己的分词。
- E:\developer\es\elasticsearch-7.9.1\plugins\ik\config目录下新建自己的dic文件:
customer.dic
1
2幸福了
然后呢 - 修改配置文件
E:\developer\es\elasticsearch-7.9.1\plugins\ik\config\IKAnalyzer.cfg.xml
:1
<entry key="ext_dict">customer.dic</entry>
- 重启ES
- 继续访问
以后我们可以配置自己的分词规则。