Elasticsearch Getting Started (three IK word breaker installation)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.