Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 5.47 KB

elasticsearch-analysis-ik.md

File metadata and controls

64 lines (50 loc) · 5.47 KB

IK Analysis for Elasticsearch

Custom Dictionary ??

  • Dictionary Configuration - medcl/elasticsearch-analysis-ik: The IK Analysis plugin integrates Lucene IK analyzer into elasticsearch, support customized dictionary. #ril
    • IKAnalyzer.cfg.xml can be located at {conf}/analysis-ik/config/IKAnalyzer.cfg.xml or {plugins}/elasticsearch-analysis-ik-*/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">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>
      

繁體中文 ?? {: #traditional-chinese }

安裝設定 ?? {: #installation }

  • medcl/elasticsearch-analysis-ik: The IK Analysis plugin integrates Lucene IK analyzer into elasticsearch, support customized dictionary.
    • 安裝方法都是將 plugin ZIP (只有 4.3 MB) 解開放進 $ES_ROOT/plugins/xxx,下面兩種做法只是手動/自動的差別而已,最後都要 restart ES。

    • optional 1 - 1) download pre-build package from here: https://github.com/medcl/elasticsearch-analysis-ik/releases 2) create plugin folder cd your-es-root/plugins/ && mkdir ik 3) unzip plugin to folder your-es-root/plugins/ik 直接把 zip 解開到放到 $ES_ROOT/plugins/xxx 即可。

    • optional 2 - use elasticsearch-plugin to install (supported from version v5.5.1):

      $ ES_VERSION=6.3.0
      $ ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v$ES_VERSION/elasticsearch-analysis-ik-$ES_VERSION.zip
      
    • 為什麼不同 ES 的版本,就要採用不同的 IK,近期更是呈現 1-to-1 的關係,為什麼兩者綁得這麼緊??

參考資料