ES Official only support SMARTCN this Chinese word-breaker, is indexed according to a single word. When searching for a front-end product, all those with this keyword will be indexed. To make an analogy: search for "apple" keyword, usually contains "ping" and "fruit" title will be indexed to. So in order to this demand, find a third-party Chinese word-breaker plug-in. Look at the domestic there are several sub-segmentation plug-ins: ik, ANSJ and mmseg. Finally I chose to use IK.
ES1.4 installed IK, encountered a lot of pits. Finally, let's share the IK installation steps.
1. Download the ES source code and compile it to copy the corresponding jar package to the $es_home/plugins/directory.
2. Download the IK profile and copy it to the $es_home/config/directory.
3. Modify the ELASTICSEARCH.YML configuration file
4. Test IK
1. First download the ES source code and compile it
wget--no-check-certificate unzip master.zipcd elasticsearch-analysis-ik-mastermvn clean install-dmaven.test.skip= True #编译过程, the appropriate jar package needs to be downloaded. So drink a cup of coffee and wait ... Compile the compiled elasticsearch-analysis-ik-1.2.9.zip, unzip, copy to the $es_home/plugins directory
corresponding JAR package:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/A9/wKiom1S3QOXgwvjLAAGh7vfa4x4734.jpg "title=" 1111. PNG "alt=" wkiom1s3qoxgwvjlaagh7vfa4x4734.jpg "/>
2. download the IK profile and copy it to the $es_home/config/directory
Https://github.com/davidbj/elasticsearch-rtf/archive/master.zipunzip master.zip Copy the extracted directory Config/ik folder to $es_home/ Config directory
3. Change the $ES_HOME/CONFIG/ELASTICSEARCH.YML configuration file
index: analysis: analyzer: ik: alias: [ik_analyzer] type: org.elasticsearch.index.analysis.IkAnalyzerProvider ik_max_word: type: ik use_smart: false ik_smart: type: ik use_smart: true #或 index.analysis.analyzer.ik.type : "IK"
Finally restart the Elaticsearch service
4. Test:
Curl-xpost "Test results are as follows {tokens: [{token:text start_offset:2 end_offset:6 type:english position:1} {token: I Start_offset:9 end_offset:10 Type:cn_char Position:2} {token: Chinese start_offset:11 end_offset:14 type:cn_wor D Position:3} {token: Chinese start_offset:11 end_offset:13 Type:cn_word Position:4} {token: Countrymen Start_offset: End_offset:14 Type:cn_word Position:5}]}
At this point, the IK plugin for ES has been installed configuration complete ~
For more details, please see the official documentation: Https://github.com/awnuxkjy/es-ik
This article is from the "David" blog, so be sure to keep this source http://davidbj.blog.51cto.com/4159484/1604393
ES1.4 Chinese word plugin ik