ELK---- Elasticsearch 使用ik中文分词器增加拓展热词

进入到我们ik分词器安装目录下的config目录

cd /usr/local/myapp/elasticsearch-6.4.3/plugins/ik/config
vi IKAnalyzer.cfg.xml 
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"></entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords"></entry>
<!--用户可以在这里配置远程扩展字典 -->
<!-- <entry key="remote_ext_dict">words_location</entry> -->
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>

 

加红部分替换为

 <!--用户可以在这里配置自己的扩展字典 -->

    <entry key="ext_dict">custom/new_word.dic</entry>

然后在config目录下新建文件夹

mkdir custom
vi custom/new_word.dic

写入相应内容

 

 

重新启动 服务Elasticsearch。。

 

 

再次搜索

 

 

 

证明加载的分词生效了。

 

posted on 2019-12-25 23:22  陈惟鲜的博客  阅读(900)  评论(0编辑  收藏  举报

导航