LoginSignup
4
4

More than 5 years have passed since last update.

elasticsearch plugin 2.0.0 upgradeメモ

Last updated at Posted at 2015-10-07

1.6.x => 2.0.0にversion upする上でハマったところをメモっておく

注意点

  • プラグインディレクトリのrootにplugin-descriptor.propertiesが必要
  • jarファイルの重複があると落ちる

plugin-descriptor.propertiesについて

これを参考にしてください
https://github.com/elastic/elasticsearch/blob/f0252f34e97adc32d58215e59a70f2c7bb41dfc8/dev-tools/src/main/resources/plugin-metadata/plugin-descriptor.properties

pluginクラス

AbstractPlugin => Plugin に変更

package org.elasticsearch.plugin.example;

import org.elasticsearch.plugins.Plugin;

public class ExamplePlugin extends Plugin {
    @Override public String name() {
        return "example-plugin";
    }

    @Override public String description() {
        return "Example Plugin Description";
    }
}

scorer factoryクラス

needsScoresメソッドの追加


    public final class ExampleScoreFactory implements NativeScriptFactory {

    @Override
    public ExecutableScript newScript(final @Nullable Map<String, Object> params) {
        return new ExampleScorer(params);
    }

    @Override
    public boolean needsScores() {
        return true;
    };

query parser

pluginの登録はこんな感じが正解なよう。


import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.indices.IndicesModule;

public class ExampleQueryParserPlugin extends Plugin {
    public String name() {
        return "example query parser";
    }

    public String description() {
        return "example query parser plugin";
    }

    public void onModule(IndicesModule module){
        module.registerQueryParser(ExampleQueryParser.class);
    }

}

参考

続く。。。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4