Install elasticsearch-jieba-plugin 7.4.2 and analysis-kuromoji Japanese word breaker in elasticsearch7.5.1 cluster under centos7 system

elasticsearch7. . 5 .1 jieba-cluster-mounted plugin elasticsearch 7.4 . 2 and Analysis- kuromoji Japanese tokenizer

To install the plug-in, you need to restart the es program after installing one of the nodes in the cluster. After there is no problem, copy it to other nodes to take effect after restarting

1. Elasticsearch- Jieba needs to be compiled using gradle
# Install gradle
Download gradle binary

wget https://services.gradle.org/distributions/gradle-6.3-bin.zip
cd /usr/local/elk

# Modify the environment variable and add gradle to the environment variable
# vim /etc/profile

export GRADLE_HOME=/usr/local/elk/gradle-6.3/
export PATH=$GRADLE_HOME/bin:$PATH

screen -S gradle

# Compile and generate jieba word segmentation plugin
[elasticsearch@sz_ms_influenex_es_dev01_17_19 elasticsearch-jieba-plugin-7.4.2]$ gradle pz

Welcome to Gradle 6.3!

Here are the highlights of this release:
 - Java 14 support
 - Improved error messages for unexpected failures

For more details see https://docs.gradle.org/6.3/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3m 23s
4 actionable tasks: 4 executed

The final compiler generated # elasticsearch -jieba-Plugin- 7.4 . 2 .zip es widget catalog copy to
 CP / usr / local / Elk / elasticsearch- 7.5 . . 1 / plugins / elasticsearch-jieba-Plugin- 7.4 . 2 / Build / Distributions / elasticsearch-jieba-Plugin- 7.4 . 2 . ZIP / usr / local / Elk / elasticsearch- 7.5 . . 1 / plugins / 
CD / usr / local / Elk / elasticsearch- 7.5 . . 1 / plugins /
 the unzip -d jieba elasticsearch Plugin---jieba 7.4 . 2 . ZIP


# Jieba modify the configuration, because there is no date jieba 7.5 . 1 plug-in, you can directly modify the configuration
# cat /usr/local/elk/elasticsearch-7.5.1/plugins/jieba/plugin-descriptor.properties 
description=A jieba analysis of plugins for Elasticsearch

version = 7.5 . 1 
name = jieba
classname=org.elasticsearch.plugin.analysis.jieba.AnalysisJiebaPlugin
java.version=8

elasticsearch.version=7.5.1

# Restart elasticsearch

[root@sz_ms_influenex_es_dev01_17_19 ~]# /usr/local/elk/elasticsearch-7.5.1/bin/elasticsearch-plugin list
jieba


# Test
[root @ sz_ms_influenex_es_dev02_17_20 elasticsearch - 7.5 . 1 ] # curl -H " Content-Type: application / json " -u elastic: pass -XPOST http: // 10.10.17.19:9200/_analyze -d '{"analyzer": " jieba_index "," text ":" Hello, world, nice to meet you! "} ' 
{ " tokens " : [{ " token " : " Hello " , " start_offset " : 0 , " end_offset " : 2 , "type":"word","position":0},{"token":"","start_offset":2,"end_offset":3,"type":"word","position":1},{"token":"世界","start_offset":3,"end_offset":5,"type":"word","position":2},{"token":"","start_offset":5,"end_offset":6,"type":"word","position":3},{"token":"","start_offset":6,"end_offset":7,"type":"word","position":4},{"token":"高兴","start_offset":7,"end_offset":9,"type":"word","position":5},{"token":"认识","start_offset":9,"end_offset":11,"type":"word","position":6},{"token":"","start_offset":11,"end_offset":12,"type":"word","position":7},{"token":"","start_offset":12,"end_offset":13,"type":"word","position":8}]}


# Copy the jieba plugin to other nodes

scp -P 2016 -r jieba 10.10 . 17.21 : / usr / local / elk / elasticsearch- 7.5 . 1 / plugins /

# Pay attention to modify file permissions
chown -R elasticsearch.elasticsearch /usr/local/elk/elasticsearch-7.5.1/

# Restart es under elasticsearch user
on elasticsearch

curl -H " Content-Type: application / json " -u elastic: pass -XPOST http: // 10.10.17.20:9200/_analyze -d '{"analyzer": "jieba_index", "text": "Hello, World, nice to meet you! "} ' 
Curl -H " Content-Type: application / json " -u elastic: pass -XPOST http: // 10.10.17.21:9200/_analyze -d' {" analyzer ":" jieba_index "," text ":" Hello, world, nice to meet you! "} '



2. Analysis - installation of kuromoji Japanese word breaker
# Download tokenizer
Cd / Usr / Local / Elk / Elasticsearch- 7.5 . 1 / Plugins
 Wget Https: // Artifacts.Elastic.Co/downloads/elasticsearch-plugins/analysis-kuromoji/analysis-kuromoji-7.5.1.Zip 
Unzip -D Kuromoji Analysis -Kuromoji- 7.5 . 1 . Zip 
Rm -F Analysis-Kuromoji- 7.5 . 1 . Zip

# Switch to elasticsearch user and restart es program
on elasticsearch

# Copy to other nodes and restart
# Pay attention to modify file permissions
chown -R elasticsearch.elasticsearch /usr/local/elk/elasticsearch-7.5.1/

 

Guess you like

Origin www.cnblogs.com/reblue520/p/12700947.html