How to install elasticsearch Chinese word Segmentation plug-in Synonym-Analysis
This article mainly introduces "how to install elasticsearch Chinese word segmentation plug-in Synonym-Analysis". In daily operation, I believe many people have doubts about how to install elasticsearch Chinese word segmentation plug-in Synonym-Analysis. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to install elasticsearch Chinese word segmentation plug-in Synonym-Analysis". Next, please follow the editor to study!
Elasticsearch version 7.3
Install the synonym plugin
The corresponding version of the plug-in needs to be the same as the version of elasticsearch
Plug-in download address
Https://github.com/bells/elasticsearch-analysis-dynamic-synonym
The installation steps are as follows:
Create a new analysis-dynamic-synonym folder under the elasticsearch-7.3.0/plugins directory
If it is the latest version of master, you need to use maven to compile the jar and put it in the folder you just built. If it is another version that has already been compiled, you can copy it directly. In this case, you need the compiled version.
Add plugin-descriptor.properties and plugin-security.policy at the same time, see below for details
Restart the cluster
The remote thesaurus is also based on Last-Modified and ETag in http header to determine whether it needs to be updated. For more information, please refer to my other blog article, which is the same elasticsearch Chinese word segmentation plug-in IK-Analyze.
After compilation, you only get a jar package. In fact, the elasticsearch installation plug-in also needs the configuration file plugin-descriptor.properties. If there is no such file, an error will be reported. The contents of the file are as follows.
Description=Analysis-plugin for synonymversion=5.1.1name=analysis-dynamic-synonymclassname=com.bellszhu.elasticsearch.plugin.DynamicSynonymPluginjava.version=1.8elasticsearch.version=7.3.0
You also need to put in the configuration file plugin-security.policy
Grant {/ / needed because of the hot reload functionality permission java.net.SocketPermission "*", "connect,resolve";}
If elasticsearch reports the wrong message
Failed to get synonyms: http://10.0.11.1:10002/elasticsearch/synonymDictaccess denied ("java.net.SocketPermission"10.0.11.1 denied 10002"connect,resolve")
The reason is the missing plugin-security.policy file.
Commons httpclient these jar can be downloaded from a lower version of the plug-in.
All files of the plug-in are as follows:
Test synonym plug-in
Create an index that specifies a remote thesaurus
PUT / full_text_test123 {"settings": {"index": {"analysis": {"analyzer": {"ik_syno_smart": {"tokenizer": "ik_max_word", "type": "custom" "filter": ["remote_synonym"]}, "filter": {"remote_synonym": {"type": "dynamic_synonym", "synonyms_path": "http://10.0.11.1:10002/elasticsearch/synonymDict"," "interval": 30}}, "mappings": {"properties": {"content": {"type": "text", "analyzer": "ik_syno_smart", "search_analyzer": "ik_smart"}
Add synonyms
Executive parser
POST / full_text_test123/_analyze {"text": ["tomato"], "analyzer": "ik_syno_smart"}
Result
{"tokens": [{"token": "tomato", "start_offset": 0, "end_offset": 3, "type": "CN_WORD", "position": 0}, {"token": "tomato", "start_offset": 0, "end_offset": 3 "type": "SYNONYM", "position": 0}]} so far The study on "how to install elasticsearch Chinese word segmentation plug-in Synonym-Analysis" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!