Loading...
Elasticsearch

elasticsearchにPluginをインストールする方法

公式のリファレンスにも記載がありますが、備忘として

公式リファレンスInstalling Plugins

elasticsearch-pluginの場所

リファレンスで案内されている「elasticsearch-plugin」ってどこにあるんだよ。という話ですが。

/usr/share/elasticsearch/bin/elasticsearch-plugin

CentOS7、yumでインストールした場合ここにあります。

インストール時の手順

オンラインインストール

日本語を取り扱えるようにするkuromojiをインストールしてみます。

[root@es-lin01 ~]# cd /usr/share/elasticsearch/
[root@es-lin01 elasticsearch]# bin/elasticsearch-plugin install analysis-kuromoji

結果

-> Downloading analysis-kuromoji from elastic
[=================================================] 100%??
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.bouncycastle.jcajce.provider.drbg.DRBG (file:/usr/share/elasticsearch/lib/tools/plugin-cli/bcprov-jdk15on-1.61.jar) to constructor sun.security.provider.Sun()
WARNING: Please consider reporting this to the maintainers of org.bouncycastle.jcajce.provider.drbg.DRBG
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
-> Installed analysis-kuromoji

オフラインインストール

ネットに出れない環境の場合は同じコマンドでファイルからインストールが可能です。

[root@es-lin01 ~]# cd /usr/share/elasticsearch/
[root@es-lin01 elasticsearch]# bin/elasticsearch-plugin install file:///tmp/analysis-kuromoji.zip

指定するのはzipのアーカイブファイルでOKです。

※2020/01追記:kuromojiのバージョン合わせと過去バージョンのダウンロードについて

kuromojiのVersionはES本体のバージョンと併せる必要があります。(例えばESが7.5.2ならkuromojiもv7.5.2が必要です。)
過去バージョンは配布ページはありませんが、URLを直接打ち込むことでzipのダウンロードが可能です。

https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-kuromoji/analysis-kuromoji-x.x.x.zip

上記URLの「x」を変更して、ブラウザやWgetでダウンロードしましょう。

結果の確認

Installできたかの確認も同様にelasticsearch-pluginコマンドで行えます。

[root@es-lin01 elasticsearch]# bin/elasticsearch-plugin list
analysis-kuromoji

インストールしたPluginがリストに表示されればOKです。