java.lang.Object
org.elasticsearch.rest.BaseRestHandler
- All Implemented Interfaces:
RestHandler
- Direct Known Subclasses:
AbstractCatAction
,RestAddIndexBlockAction
,RestAddVotingConfigExclusionAction
,RestAnalyzeAction
,RestAnalyzeIndexDiskUsageAction
,RestBulkAction
,RestCancelTasksAction
,RestCatAction
,RestCleanupRepositoryAction
,RestClearIndicesCacheAction
,RestClearScrollAction
,RestClearVotingConfigExclusionsAction
,RestCloneSnapshotAction
,RestCloseIndexAction
,RestClosePointInTimeAction
,RestClusterAllocationExplainAction
,RestClusterGetSettingsAction
,RestClusterHealthAction
,RestClusterInfoAction
,RestClusterRerouteAction
,RestClusterSearchShardsAction
,RestClusterStateAction
,RestClusterStatsAction
,RestClusterUpdateSettingsAction
,RestCountAction
,RestCreateIndexAction
,RestCreateSnapshotAction
,RestDeleteAction
,RestDeleteComponentTemplateAction
,RestDeleteComposableIndexTemplateAction
,RestDeleteDanglingIndexAction
,RestDeleteDesiredBalanceAction
,RestDeleteDesiredNodesAction
,RestDeleteIndexAction
,RestDeleteIndexTemplateAction
,RestDeletePipelineAction
,RestDeleteRepositoryAction
,RestDeleteSnapshotAction
,RestDeleteStoredScriptAction
,RestDeleteSynonymRuleAction
,RestDeleteSynonymsAction
,RestExplainAction
,RestFieldCapabilitiesAction
,RestFieldUsageStatsAction
,RestFlushAction
,RestForceMergeAction
,RestGetAction
,RestGetAliasesAction
,RestGetComponentTemplateAction
,RestGetComposableIndexTemplateAction
,RestGetDesiredBalanceAction
,RestGetDesiredNodesAction
,RestGetFeatureUpgradeStatusAction
,RestGetFieldMappingAction
,RestGetHealthAction
,RestGetIndexTemplateAction
,RestGetIndicesAction
,RestGetMappingAction
,RestGetPipelineAction
,RestGetRepositoriesAction
,RestGetScriptContextAction
,RestGetScriptLanguageAction
,RestGetSettingsAction
,RestGetSnapshotsAction
,RestGetSourceAction
,RestGetStoredScriptAction
,RestGetSynonymRuleAction
,RestGetSynonymsAction
,RestGetSynonymsSetsAction
,RestGetTaskAction
,RestImportDanglingIndexAction
,RestIndexAction
,RestIndexDeleteAliasesAction
,RestIndexPutAliasAction
,RestIndicesAliasesAction
,RestIndicesSegmentsAction
,RestIndicesShardStoresAction
,RestIndicesStatsAction
,RestKnnSearchAction
,RestListDanglingIndicesAction
,RestListTasksAction
,RestMultiGetAction
,RestMultiSearchAction
,RestMultiTermVectorsAction
,RestNodesHotThreadsAction
,RestNodesInfoAction
,RestNodesStatsAction
,RestNodesUsageAction
,RestOpenIndexAction
,RestOpenPointInTimeAction
,RestPendingClusterTasksAction
,RestPostFeatureUpgradeAction
,RestPrevalidateNodeRemovalAction
,RestPutComponentTemplateAction
,RestPutComposableIndexTemplateAction
,RestPutIndexTemplateAction
,RestPutMappingAction
,RestPutPipelineAction
,RestPutRepositoryAction
,RestPutStoredScriptAction
,RestPutSynonymRuleAction
,RestPutSynonymsAction
,RestRecoveryAction
,RestRefreshAction
,RestReloadAnalyzersAction
,RestReloadSecureSettingsAction
,RestRemoteClusterInfoAction
,RestResetFeatureStateAction
,RestResizeHandler
,RestResolveIndexAction
,RestRestoreSnapshotAction
,RestRolloverIndexAction
,RestSearchAction
,RestSearchScrollAction
,RestSimulateIndexTemplateAction
,RestSimulatePipelineAction
,RestSimulateTemplateAction
,RestSnapshotsStatusAction
,RestSnapshottableFeaturesAction
,RestSyncedFlushAction
,RestTermVectorsAction
,RestUpdateAction
,RestUpdateDesiredNodesAction
,RestUpdateSettingsAction
,RestUpgradeActionDeprecated
,RestValidateQueryAction
,RestVerifyRepositoryAction
Base handler for REST requests.
This handler makes sure that the headers & context of the handled requests
are copied over to
the transport requests executed by the associated client. While the context is fully copied over, not all the headers
are copied, but a selected few. It is possible to control what headers are copied over by returning them in
ActionPlugin.getRestHeaders()
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
REST requests are handled by preparing a channel consumer that represents the execution of the request against a channel.Nested classes/interfaces inherited from interface org.elasticsearch.rest.RestHandler
RestHandler.Route
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
static final String
Parameter that controls whether certain REST apis should include type names in their requests or responses. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract String
getName()
final long
final void
handleRequest
(RestRequest request, RestChannel channel, NodeClient client) Handles a rest request.protected abstract BaseRestHandler.RestChannelConsumer
prepareRequest
(RestRequest request, NodeClient client) Prepare the request for execution.Parameters used for controlling the response and thus might not be consumed during preparation of the request execution inprepareRequest(RestRequest, NodeClient)
.responseParams
(RestApiVersion restApiVersion) Parameters used for controlling the response and thus might not be consumed during preparation of the request execution.abstract List<RestHandler.Route>
routes()
The list ofRestHandler.Route
s that this RestHandler is responsible for handling.protected static String
unrecognized
(RestRequest request, Set<String> invalids, Set<String> candidates, String detail) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.rest.RestHandler
allowsUnsafeBuffers, allowSystemIndexAccessByDefault, canTripCircuitBreaker, getConcreteRestHandler, getServerlessScope, mediaTypesValid, supportsContentStream
-
Field Details
-
INCLUDE_TYPE_NAME_PARAMETER
Parameter that controls whether certain REST apis should include type names in their requests or responses. Note: This parameter is only available through compatible rest api forRestApiVersion.V_7
.- See Also:
-
DEFAULT_INCLUDE_TYPE_NAME_POLICY
public static final boolean DEFAULT_INCLUDE_TYPE_NAME_POLICY- See Also:
-
MULTI_ALLOW_EXPLICIT_INDEX
-
-
Constructor Details
-
BaseRestHandler
public BaseRestHandler()
-
-
Method Details
-
getUsageCount
public final long getUsageCount() -
getName
- Returns:
- the name of this handler. The name should be human readable and
should describe the action that will performed when this API is
called. This name is used in the response to the
RestNodesUsageAction
.
-
routes
The list ofRestHandler.Route
s that this RestHandler is responsible for handling.- Specified by:
routes
in interfaceRestHandler
-
handleRequest
public final void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception Description copied from interface:RestHandler
Handles a rest request.- Specified by:
handleRequest
in interfaceRestHandler
- Parameters:
request
- The request to handlechannel
- The channel to write the request response toclient
- A client to use to make internal requests on behalf of the original request- Throws:
Exception
-
unrecognized
-
prepareRequest
protected abstract BaseRestHandler.RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException Prepare the request for execution. Implementations should consume all request params before returning the runnable for actual execution. Unconsumed params will immediately terminate execution of the request. However, some params are only used in processing the response; implementations can overrideresponseParams()
to indicate such params.- Parameters:
request
- the request to executeclient
- client for executing actions on the local node- Returns:
- the action to execute
- Throws:
IOException
- if an I/O exception occurred parsing the request and preparing for execution
-
responseParams
Parameters used for controlling the response and thus might not be consumed during preparation of the request execution inprepareRequest(RestRequest, NodeClient)
.- Returns:
- a set of parameters used to control the response and thus should not trip strict URL parameter checks.
-
responseParams
Parameters used for controlling the response and thus might not be consumed during preparation of the request execution. The value depends on the RestApiVersion provided by a user on a request. Used in RestHandlers with Compatible Rest Api- Parameters:
restApiVersion
- - a version provided by a user on a request- Returns:
- a set of parameters used to control the response, depending on a restApiVersion
-