Elasticsearch Chinese word Insertion jcseg installation (Ubuntu 14.04)

Source: Internet
Author: User

Search can be said to be a very common development in the scene, the same this time ...

Most of the previous combination is the choice of Mysql + Sphinx, this time because the work is no longer use this combination, although the old combination, but does limit a lot of, and every time with the environment is a problem, very annoying ... This time try to use Elasticsearch + jcseg, because in the document retrieval aspect Elasticsearch do quite good, but to the Chinese environment is poor a very good Chinese word breaker, fortunately, the domestic good Chinese word breaker also has quite many, but I personally still is more recommended Jcseg.

Okay, no more nonsense.

Release Notes:

Elasticsearch I use 1.7.2, but 1.7.3 is also feasible for the following process.

JCSEG is a version that needs 1.9.6

######--------------------------------------------------------------------------------------------------------- ---------------#####

The first is the installation of Elasticsearch, this is more convenient, according to official documents to OK.

Reference Address: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-service.html

1, install Elasticsearch

#> wget Https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb

#> sudo dpkg-i elasticsearch-1.7.2.deb

#> sudo update-rc.d elasticsearch defaults 95 10

#> sudo service elasticsearch start

Then, download the relevant jar package for JCSEG to prepare for the subsequent configuration.

: http://git.oschina.net/lionsoul/elasticsearch-jcseg

2, download jcseg

#> git clone http://git.oschina.net/lionsoul/elasticsearch-jcseg

Finally, the JCSEG is configured as a Elasticsearch plug-in, and then specify JCSEG as the default word breaker, restart Elasticsearch OK.

Reference Document: Http://git.oschina.net/lionsoul/jcseg (here is a PDF document, please refer to it)

3, Configuration Elasticsearch

#> Cd/usr/share/elasticsearch/plugins (This is the plugin directory where the above installation completes Elasticsearch)

#> mkdir analysis-jcseg (Create jcseg jar package and Thesaurus placement directory)

#> CD elasticsearch-jcseg/(Come to elasticsearch-jcseg directory, here are the jar files we need, etc.)

#> sudo cp-r plugins/analysis-jcseg/*/usr/share/elasticsearch/plugins/analysis-jcseg/(Copy the required jar package and JCSEG Thesaurus files, thesaurus files are very important, late can be based on your own business needs to expand the thesaurus, to achieve a higher accuracy rate of segmentation)

############# Start modifying the Elasticsearch configuration file, set the word breaker to use jcseg ##########

Copy elasticsearch-jcseg under config/jcseg/Entire directory to elasticsearch configuration file directory (/etc/elasticsearch/)

#> sudo cp-r config/jcseg /etc/elasticsearch/

Add the following configuration entry at the end of the Elasticsearch file: (This configuration item is elasticsearch-jcseg/config/elasticsearch.yml. )

#> sudo vim/etc/elasticsearch/elasticsearch.yml

To add a configuration entry:

Then, restart Elasticsearch

#> sudo service elasticsearch restart

You can then enter the test in the browser, as follows:

Of course, you have to have an index, my test example here is a blog, the establishment of the method is very simple, as follows:

#> Curl-xput Http:localhost:9200/blog

######--------------------------------------------------------------------------------------------------------- ---------------#####

The above is the jcseg as a elasticsearch of the Chinese word plug-in Environment configuration method, the rest is elasticsearch and jcseg things, you can study their related usage, flexible in the use of the project OK!


Elasticsearch Chinese word Insertion jcseg installation (Ubuntu 14.04)

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.