Linux安装ElasticSearch-2.2.0-分词器插件(Mmseg)

1、在gitpub上搜索elasticsearch-analysis,能够看到所有elasticsearch的分词器:

 

2、安装Mmseg分词器:https://github.com/medcl/elasticsearch-analysis-mmseg

cd /data
git clone https://github.com/medcl/elasticsearch-analysis-mmseg.git
cd elasticsearch-analysis-mmseg

mvn clean
mvn compile
mvn package
mkdir /usr/share/elasticsearch/plugins/mmseg              --在plugins目录下面创建ik目录
-- copy & unzip file #{project_path}/elasticsearch-analysis-mmseg/target/elasticsearch-analysis-mmseg-*.zip to your elasticsearch's folder: plugins/mmseg
mv target/releases/elasticsearch-analysis-mmseg-1.8.0.zip /usr/share/elasticsearch/plugins/mmseg/ 
unzip elasticsearch-analysis-mmseg-1.8.0.zip

 

  3、配置IK Analysis:https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html

在elasticsearch.yml文件的末尾处加上(http://blog.csdn.net/huwei2003/article/details/40591191

vim /etc/elasticsearch/elasticsearch.yml

index:
    analysis: 
        analyzer:
            mmseg_maxword:
                type: custom
                filter: [lowercase]
                tokenizer: mmseg_maxword
            mmseg_maxword_with_cut_letter_digi:
                type: custom
                filter: [lowercase,cut_letter_digit]
                tokenizer: mmseg_maxword
#        tokenizer: 
#            mmseg_maxword: 
#                type: mmseg 
#                seg_type: "max_word" 
#            mmseg_complex: 
#                type: mmseg 
#                seg_type: "complex" 
#            mmseg_simple: 
#                type: mmseg 
#                seg_type: "simple"

4、重起elasticsearch服务

service elasticsearch restart

5、测试mmseg分词器

 

posted @ 2016-03-09 13:43  —八戒—  阅读(1081)  评论(0编辑  收藏  举报