简体   繁体   English

Elasticsearch - 构建和安装插件

[英]Elasticsearch - Building and Installing plugins

I use command ./plugin -i medcl/elasticsearch-analysis-ik/1.2.6 to install plugin 我使用命令./plugin -i medcl/elasticsearch-analysis-ik/1.2.6来安装插件
But I got Error while installing plugin, reason:IllegalArgumentException: Plugin installation assumed to be site plugin, but contains source code, aborting installation. 但是我Error while installing plugin, reason:IllegalArgumentException: Plugin installation assumed to be site plugin, but contains source code, aborting installation.遇到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 . 但是我对JAVA并不熟悉, 官方文件即使IK Analysis Plugin (by Medcl)列表在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. 它必须从源代码构建,因为插件不提供dist(最终可安装的jar)文件。 The plugin is a maven project. 该插件是一个maven项目。 You need not know anything about java. 你不需要了解任何关于java的知识。 Maven is a dependency management and build tool. Maven是一个依赖管理和构建工具。 So, 所以,

How to build? 怎么建?

  1. Download apache maven - http://maven.apache.org/download.cgi , extract the archive file. 下载apache maven - http://maven.apache.org/download.cgi ,解压缩归档文件。
  2. Include maven in your system path variable - C:\\<maven path>\\maven-3.2.1\\bin 在系统路径变量中包含maven - 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 转到插件目录root(假设您的root是c:/es/elasticsearch-analysis-ik ),其中有一个pom.xml文件并执行命令 - 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. 这将构建项目并在c:/es/elasticsearch-analysis-ik/target中生成一个jar文件,这是您需要在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 执行命令 - 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. 只需重新启动elasticsearch和tada即可启动并运行插件。

Also don't forget to Shutdown elasticsearch and remove previously installed version of plugin: 另外不要忘记关闭elasticsearch并删除以前安装的插件版本:

$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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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