Package org.elasticsearch.plugins
Interface ActionPlugin
-
public interface ActionPluginAn additional extension point forPlugins that extends Elasticsearch's scripting functionality. Implement it like this:{@literal @}Override public List<ActionHandler<?, ?>> getActions() { return Arrays.asList(new ActionHandler<>(ReindexAction.INSTANCE, TransportReindexAction.class), new ActionHandler<>(UpdateByQueryAction.INSTANCE, TransportUpdateByQueryAction.class), new ActionHandler<>(DeleteByQueryAction.INSTANCE, TransportDeleteByQueryAction.class), new ActionHandler<>(RethrottleAction.INSTANCE, TransportRethrottleAction.class)); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classActionPlugin.ActionHandler<Request extends ActionRequest,Response extends ActionResponse>
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default List<ActionFilter>getActionFilters()ActionType filters added by this plugin.default List<ActionPlugin.ActionHandler<? extends ActionRequest,? extends ActionResponse>>getActions()Actions added by this plugin.default List<ActionType<? extends ActionResponse>>getClientActions()Client actions added by this plugin.default List<RestHandler>getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster)Rest handlers added by this plugin.default UnaryOperator<RestHandler>getRestHandlerWrapper(ThreadContext threadContext)Returns a function used to wrap each rest request before handling the request.default Collection<String>getRestHeaders()Returns headers which should be copied through rest requests on to internal requests.default Collection<String>getTaskHeaders()Returns headers which should be copied from internal requests into tasks.default Collection<RequestValidators.RequestValidator<IndicesAliasesRequest>>indicesAliasesRequestValidators()default Collection<RequestValidators.RequestValidator<PutMappingRequest>>mappingRequestValidators()Returns a collection of validators that are used byRequestValidatorsto validate aPutMappingRequestbefore the executing it.
-
-
-
Method Detail
-
getActions
default List<ActionPlugin.ActionHandler<? extends ActionRequest,? extends ActionResponse>> getActions()
Actions added by this plugin.
-
getClientActions
default List<ActionType<? extends ActionResponse>> getClientActions()
Client actions added by this plugin. This defaults to all of the ActionType in getActions().
-
getActionFilters
default List<ActionFilter> getActionFilters()
ActionType filters added by this plugin.
-
getRestHandlers
default List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster)
Rest handlers added by this plugin.
-
getRestHeaders
default Collection<String> getRestHeaders()
Returns headers which should be copied through rest requests on to internal requests.
-
getTaskHeaders
default Collection<String> getTaskHeaders()
Returns headers which should be copied from internal requests into tasks.
-
getRestHandlerWrapper
default UnaryOperator<RestHandler> getRestHandlerWrapper(ThreadContext threadContext)
Returns a function used to wrap each rest request before handling the request. The returnedUnaryOperatoris called for every incoming rest request and receives the original rest handler as it's input. This allows adding arbitrary functionality around rest request handlers to do for instance logging or authentication. A simple example of how to only allow GET request is here:
Note: Only one installed plugin may implement a rest wrapper.UnaryOperator<RestHandler> getRestHandlerWrapper(ThreadContext threadContext) { return originalHandler -> (RestHandler) (request, channel, client) -> { if (request.method() != Method.GET) { throw new IllegalStateException("only GET requests are allowed"); } originalHandler.handleRequest(request, channel, client); }; }
-
mappingRequestValidators
default Collection<RequestValidators.RequestValidator<PutMappingRequest>> mappingRequestValidators()
Returns a collection of validators that are used byRequestValidatorsto validate aPutMappingRequestbefore the executing it.
-
indicesAliasesRequestValidators
default Collection<RequestValidators.RequestValidator<IndicesAliasesRequest>> indicesAliasesRequestValidators()
-
-