elasticsearch-analysis-ik 分詞器下載下傳與安裝
前言
部落格書
github 連結:
https://github.com/medcl/elasticsearch-analysis-ikgithub 下載下傳位址:
https://github.com/medcl/elasticsearch-analysis-ik/releasesIK 分詞器分詞
分類
- ik_smart : ik 智能分詞
- ik_max_word : ik 最細分詞
自定義分詞 & 自定義停用詞彙
修改 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">custom/mydict.dic;custom/single_word_low_freq.dic</entry>
<!--使用者可以在這裡配置自己的擴充停止詞字典-->
<entry key="ext_stopwords">custom/ext_stopword.dic</entry>
<!--使用者可以在這裡配置遠端擴充字典 -->
<entry key="remote_ext_dict">location</entry>
<!--使用者可以在這裡配置遠端擴充停止詞字典-->
<entry key="remote_ext_stopwords">http://xxx.com/xxx.dic</entry>
</properties>
dic 示例
隻需要把詞彙添加對應擴充字典即可
八面圓通
八面威風
八面張羅
八面來風
八面玲珑
八面瑩澈
八面見光
安裝
安裝到 docker 中 的 elasticsearch
# 上傳 elasticsearch-analysis-ik-7.4.2.zip 檔案,并解壓
unzip elasticsearch-analysis-ik-7.4.2.zip -d elasticsearch-analysis-ik-7.4.2
# 拷貝到 docker 容器中的 elasticsearch/plugins 目錄下
docker cp elasticsearch-analysis-ik-7.4.2 454244b9aa0c:/usr/share/elasticsearch/plugins
通路測試