Why only one REST wrapper exists and not nested?

Hello everyone,
Elasticsearch reports a error when I installed ranger elasticsearch plugin and restarted Elasticsearch:
"Cannot have more than one plugin implementing a REST wrapper".
Later, I found that there is a class named RangerElasticsearchPlugin in ranger elasticsearch plugin which implements org.elasticsearch.plugins.ActionPlugin, and in the elasticsearch.yml config file, xpack.security.enabled is true. This's what caused the above error.
So I changed the elasticsearch code in org.elasticsearch.action.ActionModule <init> method to make it work well:

for (ActionPlugin plugin : actionPlugins) {
UnaryOperator<RestHandler> newRestWrapper = plugin.getRestHandlerWrapper(threadPool.getThreadContext());
if (newRestWrapper != null) {
logger.debug("Using REST wrapper from plugin " + plugin.getClass().getName());
if (restWrapper != null) {
UnaryOperator<RestHandler> newRestWrapperReference = newRestWrapper;
UnaryOperator<RestHandler> restWrapperReference = restWrapper;
newRestWrapper = (handler) -> newRestWrapperReference.apply(restWrapperReference.apply(handler));
//  throw new IllegalArgumentException("Cannot have more than one plugin implementing a REST wrapper");
restWrapper = newRestWrapper;

Maybe my usage of ranger elasticsearch plugin is wrong, but I would like to know what the risks are if I change like this, or why only one REST wrapper existed instead of nesting it?


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