diff --git a/core/src/main/java/org/elasticsearch/plugins/PluginsService.java b/core/src/main/java/org/elasticsearch/plugins/PluginsService.java index 9b983fa2931..71081740d33 100644 --- a/core/src/main/java/org/elasticsearch/plugins/PluginsService.java +++ b/core/src/main/java/org/elasticsearch/plugins/PluginsService.java @@ -44,6 +44,7 @@ import org.elasticsearch.index.IndexModule; import org.elasticsearch.script.NativeScriptFactory; import org.elasticsearch.script.ScriptContext; import org.elasticsearch.script.ScriptEngineService; +import org.elasticsearch.script.ScriptModule; import org.elasticsearch.threadpool.ExecutorBuilder; import java.io.IOException; @@ -206,8 +207,13 @@ public class PluginsService extends AbstractComponent { } Class moduleClass = method.getParameterTypes()[0]; if (!Module.class.isAssignableFrom(moduleClass)) { - logger.warn("Plugin: {} implementing onModule by the type is not of Module type {}", pluginEntry.v1().getName(), moduleClass); - continue; + if (moduleClass == ScriptModule.class) { + // This is still part of the Plugin class to point the user to the new implementation + continue; + } + throw new RuntimeException( + "Plugin: [" + pluginEntry.v1().getName() + "] implements onModule taking a parameter that isn't a Module [" + + moduleClass.getSimpleName() + "]"); } list.add(new OnModuleReference(moduleClass, method)); } diff --git a/docs/reference/migration/migrate_5_0/plugins.asciidoc b/docs/reference/migration/migrate_5_0/plugins.asciidoc index 1578ae074df..a1c0dad9ca1 100644 --- a/docs/reference/migration/migrate_5_0/plugins.asciidoc +++ b/docs/reference/migration/migrate_5_0/plugins.asciidoc @@ -117,3 +117,8 @@ via ES_JAVA_OPTS. The ability to specify a custom plugins path via `path.plugins` has been removed. + +==== ScriptPlugin + +Plugins that register custom scripts should implement `ScriptPlugin` and remove +their `onModule(ScriptModule)` implementation.