Help - Create Plugin 6.6

Hi guys, I need a little help. Ante in ElasticSearch version 2.4 to add several scripts to a plugin was with 'module.registerScript ()' now in version 6.6 how should I add my various scripts? I have not found the way it should be. A little help would be good. Greetings.

My Code GitHub: https://github.com/EliuFlorez/recurring-plugin

before plugin:

package org.devmaster.elasticsearch.plugin;

import org.devmaster.elasticsearch.index.mapper.RecurringFieldMapper;
import org.devmaster.elasticsearch.script.*;
import org.elasticsearch.indices.IndicesModule;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptModule;

public class RecurringPlugin extends Plugin {

    public String name() {
        return "native-recurring-plugin";
    }

    public String description() {
        return "Native script to allow recurring feature";
    }

    public void onModule(ScriptModule module) {
        module.registerScript(NextOccurrenceSearchScript.SCRIPT_NAME, NextOccurrenceSearchScript.Factory.class);
        module.registerScript(HasOccurrencesAtSearchScript.SCRIPT_NAME, HasOccurrencesAtSearchScript.Factory.class);
        module.registerScript(OccurBetweenSearchScript.SCRIPT_NAME, OccurBetweenSearchScript.Factory.class);
        module.registerScript(NotHasExpiredSearchScript.SCRIPT_NAME, NotHasExpiredSearchScript.Factory.class);
        module.registerScript(OccurrencesBetweenSearchScript.SCRIPT_NAME, OccurrencesBetweenSearchScript.Factory.class);
        module.registerScript(HasAnyOccurrenceBetweenSearchScript.SCRIPT_NAME, HasAnyOccurrenceBetweenSearchScript.Factory.class);
    }

    public void onModule(IndicesModule module) {
        module.registerMapper(RecurringFieldMapper.CONTENT_TYPE, new RecurringFieldMapper.TypeParser());
    }

}

now plugin:

???????????????????????????????????

check out org.elasticsearch.plugins.ScriptPlugin and implement that class with a custom script engine in your plugin.

--Alex

Hello, I really do not know much about java and I do not know how to implement that part. If you can help me or collaborate it would be a great help friend. here the step of the repository link.

https://github.com/EliuFlorez/recurring-plugin

Thanks.

This forum is here to help in case you are running into issues when converting that plugin, but I am personally not here to rewrite your plugin, sorry :slight_smile:

You will definitely need some amount of java knowledge to convert the codebase. However there is also a sample scripting plugin, you can take some inspiration from https://github.com/elastic/elasticsearch/tree/6.6/plugins/examples/script-expert-scoring

thanks, I'm taking that example plugin.

Help: Plugin Custom - Multi Source?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.