ElasticSeach学习(三、IK分词器配置)

安装插件

下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases

下载版本与es相同的分词器,解压到plugins目录下面,一定要解压到一个文件夹下面,如IK,不能直接解压到plugins下面,不然启动es会报错

 重启es

扩展词库 

在config/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">extra_main.dic;extra_single_word_full.dic</entry>
     <!--用户可以在这里配置自己的扩展停止词字典-->
    <entry key="ext_stopwords">extra_stopword.dic;stopword.dic</entry>
    <!--用户可以在这里配置远程扩展字典 -->
    <!-- <entry key="remote_ext_dict">words_location</entry> -->
    <!--用户可以在这里配置远程扩展停止词字典-->
    <!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>

猜你喜欢

转载自www.cnblogs.com/Unlimited-Blade-Works/p/12533112.html