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

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

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

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

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"

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

4、重起elasticsearch服务

service elasticsearch restart

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

5、测试mmseg分词器

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

05-11 21:51