IK git address Https://github.com/medcl/elasticsearch-analysis-ik
The readme contains the ES versions of each version of IK
Download the corresponding Ikzip Package command as follows
Https://github.com/medcl/elasticsearch-analysis-ik/archive/v1.5.0.zip
Perform MAVEN package commands after decompression (the default system already has Maven installed)
MVN Package
After the successful compilation, enter target
There is a compiled Elasticsearch-analysis-ik-1.5.0.jar to copy this package to the ES Lib
There is a release package that has a elasticsearch-analysis-ik-1.5.0.zip zip that extracts this zip to Es/plugins/ik
Other than that
There is a config folder under the Elasticsearch-analysis-ik package to copy the contents of this folder to Es/config/ik
Depending on the sample given on git, you need to modify the ES.YML configuration file and set the default word breaker to IK on the last line
However, I have been in the configuration process has not been effective, each configuration will appear
indexcreationexception[failed to create index]; Nested:illegalargumentexception[unknown Analyzer Type [org.elasticsearch.index.analysis.i
Kanalyzerprovider] for [IK]];
Error
Finally I deleted the configuration to set mapping in the code to set the word breaker, online about how to set mapping code is also relatively small,
so the code is posted, the client part of the code to set their own mapping code as follows:
Client client = Elasticclient.getinstance (). Getclient (); @Test public void Testmapping () throws IOException {client.admin (). Indices (). Preparecreate ("Opac"). Execute (). AC Tionget (); Xcontentbuilder mapping = Jsonbuilder (). StartObject (). StartObject ("title") . StartObject ("Properties"). StartObject ("Recctrlid"). Field ("Type", "string"). Field ( "Store", "yes"). Field ("Index", "not_analyzed"). EndObject (). StartObject ("Titleabs"). Field ("Type" , "string"). Field ("Store", "yes"). Field ("Analyzer", "IK"). EndObject (). StartObject ("title"). Fiel D ("Type", "string"). Field ("Store", "yes"). Field ("Analyzer", "IK"). EndObject (). StartObject ("Auth ORS "). Field (" Type "," string "). Field (" Index "," analyzed "). EndObject (). StartObject (" publisher "). Field ("Type", "string"). Field ("Index", "analyzed"). EndObject () . StartObject ("Pubdatedate"). Field ("Type", "date"). EndObject (). EndObject () . EndObject (). EndObject (); Putmappingrequest mappingrequest = requests.putmappingrequest ("Opac"). Type ("title"). Source (mapping); Client.admin (). Indices (). putmapping (Mappingrequest). Actionget (); }
Elasticsearch Getting Started (three IK word breaker installation)