简体   繁体   中英

Elasticsearch - Building and Installing plugins

I use command ./plugin -i medcl/elasticsearch-analysis-ik/1.2.6 to install plugin
But I got Error while installing plugin, reason:IllegalArgumentException: Plugin installation assumed to be site plugin, but contains source code, aborting installation.
After some searching, somebody says that I should build the plugin source.
But I am not familiar with JAVA , official document do not say this even if IK Analysis Plugin (by Medcl) list under Supported by the community . How do I build the source code and where to put complied file?

It has to be build from source as the plugin does not provide a dist(final installable jar) file. The plugin is a maven project. You need not know anything about java. Maven is a dependency management and build tool. So,

How to build?

  1. Download apache maven - http://maven.apache.org/download.cgi , extract the archive file.
  2. Include maven in your system path variable - C:\\<maven path>\\maven-3.2.1\\bin
  3. Go to the plugin directory root(lets say your root is c:/es/elasticsearch-analysis-ik ) where there is a pom.xml file and execute the command - mvn compile
  4. This will build the project and generate a jar file in c:/es/elasticsearch-analysis-ik/target which is the actual file you need to use in elasticsearch.

How to use it in elastic search? As the file is in you local machine. You can use the below steps to directly install the plugin.

  1. Go to elastic search folder.

  2. Execute the command - bin\\plugin --url file:////c:/es/elasticsearch-analysis-ik/target/filename.jar --install

Just restart elasticsearch and tada you have the plugin up and running.

Also don't forget to Shutdown elasticsearch and remove previously installed version of plugin:

$ES_INSTALL_DIR=PATH_TO_ES_INSTALL
#Shutdown ES
curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'

#Remove old plugin
$ES_INSTALL_DIR/bin/plugin --remove PLUGIN_NAME

#Re-Install plugin
$ES_INSTALL_DIR/bin/plugin --url file:///PATH_TO_PLUGIN --install PLUGIN_NAME

#Start ES
ES_HEAP_SIZE=5026m  $ES_INSTALL_DIR/bin/elasticsearch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM