es之词库热更新解决方案

1、 下载tomcat,作为远程词库的容器 , 需要在tomcat中配置词库

/webapp/ROOT这个路径下新建一个远程词库:

Vim hot.dic
Hot.dic中存放的就是实时热词

2、测试tomcat启动后,是否能够访问

3、 更改ik的配置:IKAnalyzer.cfg.xml

<properties>
        <comment>IK Analyzer 扩展配置</comment>
        <!--用户可以在这里配置自己的扩展字典 -->
        <entry key="ext_dict">custom/my.dic</entry>
         <!--用户可以在这里配置自己的扩展停止词字典-->
        <entry key="ext_stopwords"></entry>
        <!--用户可以在这里配置远程扩展字典 -->
        <entry key="remote_ext_dict">http://hadoop03:8080/hot.dic</entry>
        <!--用户可以在这里配置远程扩展停止词字典-->
        <!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>

4、 更新hot.dic之后会发现es中输出如下信息:

 

posted @ 2017-05-22 23:08  niutao  阅读(2430)  评论(0编辑  收藏  举报