Deguice rest handlers (#22575)
There are presently 7 ctor args used in any rest handlers: * `Settings`: Every handler uses it to initialize a logger and some other strange things. * `RestController`: Every handler registers itself with it. * `ClusterSettings`: Used by `RestClusterGetSettingsAction` to render the default values for cluster settings. * `IndexScopedSettings`: Used by `RestGetSettingsAction` to get the default values for index settings. * `SettingsFilter`: Used by a few handlers to filter returned settings so we don't expose stuff like passwords. * `IndexNameExpressionResolver`: Used by `_cat/indices` to filter the list of indices. * `Supplier<DiscoveryNodes>`: Used to fill enrich the response by handlers that list tasks. We probably want to reduce these arguments over time but switching construction away from guice gives us tighter control over the list of available arguments. These parameters are passed to plugins using `ActionPlugin#initRestHandlers` which is expected to build and return that handlers immediately. This felt simpler than returning an reference to the ctors given all the different possible args. Breaks java plugins by moving rest handlers off of guice.
This commit is contained in:
parent
025b1a0fc5
commit
6265ef1c1b
|
@ -23,15 +23,23 @@ import org.elasticsearch.plugin.noop.action.bulk.RestNoopBulkAction;
|
|||
import org.elasticsearch.plugin.noop.action.bulk.TransportNoopBulkAction;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.plugin.noop.action.search.NoopSearchAction;
|
||||
import org.elasticsearch.plugin.noop.action.search.RestNoopSearchAction;
|
||||
import org.elasticsearch.plugin.noop.action.search.TransportNoopSearchAction;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class NoopPlugin extends Plugin implements ActionPlugin {
|
||||
@Override
|
||||
|
@ -43,7 +51,11 @@ public class NoopPlugin extends Plugin implements ActionPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Class<? extends RestHandler>> getRestHandlers() {
|
||||
return Arrays.asList(RestNoopBulkAction.class, RestNoopSearchAction.class);
|
||||
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
|
||||
IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
Supplier<DiscoveryNodes> nodesInCluster) {
|
||||
return Arrays.asList(
|
||||
new RestNoopBulkAction(settings, restController),
|
||||
new RestNoopSearchAction(settings, restController));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
*/
|
||||
package org.elasticsearch.plugin.noop.action.bulk;
|
||||
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.bulk.BulkItemResponse;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.bulk.BulkShardRequest;
|
||||
|
@ -28,7 +28,6 @@ import org.elasticsearch.action.update.UpdateResponse;
|
|||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
|
@ -47,7 +46,6 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestNoopBulkAction extends BaseRestHandler {
|
||||
@Inject
|
||||
public RestNoopBulkAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.plugin.noop.action.search;
|
|||
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -33,8 +32,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||
|
||||
public class RestNoopSearchAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestNoopSearchAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_noop_search", this);
|
||||
|
|
|
@ -19,13 +19,6 @@
|
|||
|
||||
package org.elasticsearch.action;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainAction;
|
||||
import org.elasticsearch.action.admin.cluster.allocation.TransportClusterAllocationExplainAction;
|
||||
|
@ -197,14 +190,16 @@ import org.elasticsearch.action.update.TransportUpdateAction;
|
|||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.NamedRegistry;
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
import org.elasticsearch.common.inject.multibindings.MapBinder;
|
||||
import org.elasticsearch.common.inject.multibindings.Multibinder;
|
||||
import org.elasticsearch.common.logging.ESLoggerFactory;
|
||||
import org.elasticsearch.common.network.NetworkModule;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.ActionPlugin.ActionHandler;
|
||||
|
@ -313,6 +308,15 @@ import org.elasticsearch.rest.action.search.RestSearchAction;
|
|||
import org.elasticsearch.rest.action.search.RestSearchScrollAction;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Collections.unmodifiableList;
|
||||
import static java.util.Collections.unmodifiableMap;
|
||||
|
||||
|
@ -325,6 +329,10 @@ public class ActionModule extends AbstractModule {
|
|||
|
||||
private final boolean transportClient;
|
||||
private final Settings settings;
|
||||
private final IndexNameExpressionResolver indexNameExpressionResolver;
|
||||
private final IndexScopedSettings indexScopedSettings;
|
||||
private final ClusterSettings clusterSettings;
|
||||
private final SettingsFilter settingsFilter;
|
||||
private final List<ActionPlugin> actionPlugins;
|
||||
private final Map<String, ActionHandler<?, ?>> actions;
|
||||
private final List<Class<? extends ActionFilter>> actionFilters;
|
||||
|
@ -332,15 +340,20 @@ public class ActionModule extends AbstractModule {
|
|||
private final DestructiveOperations destructiveOperations;
|
||||
private final RestController restController;
|
||||
|
||||
public ActionModule(boolean transportClient, Settings settings, IndexNameExpressionResolver resolver,
|
||||
ClusterSettings clusterSettings, ThreadPool threadPool, List<ActionPlugin> actionPlugins,
|
||||
NodeClient nodeClient, CircuitBreakerService circuitBreakerService) {
|
||||
public ActionModule(boolean transportClient, Settings settings, IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
IndexScopedSettings indexScopedSettings, ClusterSettings clusterSettings, SettingsFilter settingsFilter,
|
||||
ThreadPool threadPool, List<ActionPlugin> actionPlugins, NodeClient nodeClient,
|
||||
CircuitBreakerService circuitBreakerService) {
|
||||
this.transportClient = transportClient;
|
||||
this.settings = settings;
|
||||
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
||||
this.indexScopedSettings = indexScopedSettings;
|
||||
this.clusterSettings = clusterSettings;
|
||||
this.settingsFilter = settingsFilter;
|
||||
this.actionPlugins = actionPlugins;
|
||||
actions = setupActions(actionPlugins);
|
||||
actionFilters = setupActionFilters(actionPlugins);
|
||||
autoCreateIndex = transportClient ? null : new AutoCreateIndex(settings, clusterSettings, resolver);
|
||||
autoCreateIndex = transportClient ? null : new AutoCreateIndex(settings, clusterSettings, indexNameExpressionResolver);
|
||||
destructiveOperations = new DestructiveOperations(settings, clusterSettings);
|
||||
Set<String> headers = actionPlugins.stream().flatMap(p -> p.getRestHeaders().stream()).collect(Collectors.toSet());
|
||||
UnaryOperator<RestHandler> restWrapper = null;
|
||||
|
@ -485,147 +498,145 @@ public class ActionModule extends AbstractModule {
|
|||
return unmodifiableList(actionPlugins.stream().flatMap(p -> p.getActionFilters().stream()).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
static Set<Class<? extends RestHandler>> setupRestHandlers(List<ActionPlugin> actionPlugins) {
|
||||
Set<Class<? extends RestHandler>> handlers = new HashSet<>();
|
||||
registerRestHandler(handlers, RestMainAction.class);
|
||||
registerRestHandler(handlers, RestNodesInfoAction.class);
|
||||
registerRestHandler(handlers, RestNodesStatsAction.class);
|
||||
registerRestHandler(handlers, RestNodesHotThreadsAction.class);
|
||||
registerRestHandler(handlers, RestClusterAllocationExplainAction.class);
|
||||
registerRestHandler(handlers, RestClusterStatsAction.class);
|
||||
registerRestHandler(handlers, RestClusterStateAction.class);
|
||||
registerRestHandler(handlers, RestClusterHealthAction.class);
|
||||
registerRestHandler(handlers, RestClusterUpdateSettingsAction.class);
|
||||
registerRestHandler(handlers, RestClusterGetSettingsAction.class);
|
||||
registerRestHandler(handlers, RestClusterRerouteAction.class);
|
||||
registerRestHandler(handlers, RestClusterSearchShardsAction.class);
|
||||
registerRestHandler(handlers, RestPendingClusterTasksAction.class);
|
||||
registerRestHandler(handlers, RestPutRepositoryAction.class);
|
||||
registerRestHandler(handlers, RestGetRepositoriesAction.class);
|
||||
registerRestHandler(handlers, RestDeleteRepositoryAction.class);
|
||||
registerRestHandler(handlers, RestVerifyRepositoryAction.class);
|
||||
registerRestHandler(handlers, RestGetSnapshotsAction.class);
|
||||
registerRestHandler(handlers, RestCreateSnapshotAction.class);
|
||||
registerRestHandler(handlers, RestRestoreSnapshotAction.class);
|
||||
registerRestHandler(handlers, RestDeleteSnapshotAction.class);
|
||||
registerRestHandler(handlers, RestSnapshotsStatusAction.class);
|
||||
public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
|
||||
List<AbstractCatAction> catActions = new ArrayList<>();
|
||||
Consumer<RestHandler> registerHandler = a -> {
|
||||
if (a instanceof AbstractCatAction) {
|
||||
catActions.add((AbstractCatAction) a);
|
||||
}
|
||||
};
|
||||
registerHandler.accept(new RestMainAction(settings, restController));
|
||||
registerHandler.accept(new RestNodesInfoAction(settings, restController, settingsFilter));
|
||||
registerHandler.accept(new RestNodesStatsAction(settings, restController));
|
||||
registerHandler.accept(new RestNodesHotThreadsAction(settings, restController));
|
||||
registerHandler.accept(new RestClusterAllocationExplainAction(settings, restController));
|
||||
registerHandler.accept(new RestClusterStatsAction(settings, restController));
|
||||
registerHandler.accept(new RestClusterStateAction(settings, restController, settingsFilter));
|
||||
registerHandler.accept(new RestClusterHealthAction(settings, restController));
|
||||
registerHandler.accept(new RestClusterUpdateSettingsAction(settings, restController));
|
||||
registerHandler.accept(new RestClusterGetSettingsAction(settings, restController, clusterSettings, settingsFilter));
|
||||
registerHandler.accept(new RestClusterRerouteAction(settings, restController, settingsFilter));
|
||||
registerHandler.accept(new RestClusterSearchShardsAction(settings, restController));
|
||||
registerHandler.accept(new RestPendingClusterTasksAction(settings, restController));
|
||||
registerHandler.accept(new RestPutRepositoryAction(settings, restController));
|
||||
registerHandler.accept(new RestGetRepositoriesAction(settings, restController, settingsFilter));
|
||||
registerHandler.accept(new RestDeleteRepositoryAction(settings, restController));
|
||||
registerHandler.accept(new RestVerifyRepositoryAction(settings, restController));
|
||||
registerHandler.accept(new RestGetSnapshotsAction(settings, restController));
|
||||
registerHandler.accept(new RestCreateSnapshotAction(settings, restController));
|
||||
registerHandler.accept(new RestRestoreSnapshotAction(settings, restController));
|
||||
registerHandler.accept(new RestDeleteSnapshotAction(settings, restController));
|
||||
registerHandler.accept(new RestSnapshotsStatusAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestIndicesExistsAction.class);
|
||||
registerRestHandler(handlers, RestTypesExistsAction.class);
|
||||
registerRestHandler(handlers, RestGetIndicesAction.class);
|
||||
registerRestHandler(handlers, RestIndicesStatsAction.class);
|
||||
registerRestHandler(handlers, RestIndicesSegmentsAction.class);
|
||||
registerRestHandler(handlers, RestIndicesShardStoresAction.class);
|
||||
registerRestHandler(handlers, RestGetAliasesAction.class);
|
||||
registerRestHandler(handlers, RestAliasesExistAction.class);
|
||||
registerRestHandler(handlers, RestIndexDeleteAliasesAction.class);
|
||||
registerRestHandler(handlers, RestIndexPutAliasAction.class);
|
||||
registerRestHandler(handlers, RestIndicesAliasesAction.class);
|
||||
registerRestHandler(handlers, RestCreateIndexAction.class);
|
||||
registerRestHandler(handlers, RestShrinkIndexAction.class);
|
||||
registerRestHandler(handlers, RestRolloverIndexAction.class);
|
||||
registerRestHandler(handlers, RestDeleteIndexAction.class);
|
||||
registerRestHandler(handlers, RestCloseIndexAction.class);
|
||||
registerRestHandler(handlers, RestOpenIndexAction.class);
|
||||
registerHandler.accept(new RestIndicesExistsAction(settings, restController));
|
||||
registerHandler.accept(new RestTypesExistsAction(settings, restController));
|
||||
registerHandler.accept(new RestGetIndicesAction(settings, restController, indexScopedSettings, settingsFilter));
|
||||
registerHandler.accept(new RestIndicesStatsAction(settings, restController));
|
||||
registerHandler.accept(new RestIndicesSegmentsAction(settings, restController));
|
||||
registerHandler.accept(new RestIndicesShardStoresAction(settings, restController));
|
||||
registerHandler.accept(new RestGetAliasesAction(settings, restController));
|
||||
registerHandler.accept(new RestAliasesExistAction(settings, restController));
|
||||
registerHandler.accept(new RestIndexDeleteAliasesAction(settings, restController));
|
||||
registerHandler.accept(new RestIndexPutAliasAction(settings, restController));
|
||||
registerHandler.accept(new RestIndicesAliasesAction(settings, restController));
|
||||
registerHandler.accept(new RestCreateIndexAction(settings, restController));
|
||||
registerHandler.accept(new RestShrinkIndexAction(settings, restController));
|
||||
registerHandler.accept(new RestRolloverIndexAction(settings, restController));
|
||||
registerHandler.accept(new RestDeleteIndexAction(settings, restController));
|
||||
registerHandler.accept(new RestCloseIndexAction(settings, restController));
|
||||
registerHandler.accept(new RestOpenIndexAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestUpdateSettingsAction.class);
|
||||
registerRestHandler(handlers, RestGetSettingsAction.class);
|
||||
registerHandler.accept(new RestUpdateSettingsAction(settings, restController));
|
||||
registerHandler.accept(new RestGetSettingsAction(settings, restController, indexScopedSettings, settingsFilter));
|
||||
|
||||
registerRestHandler(handlers, RestAnalyzeAction.class);
|
||||
registerRestHandler(handlers, RestGetIndexTemplateAction.class);
|
||||
registerRestHandler(handlers, RestPutIndexTemplateAction.class);
|
||||
registerRestHandler(handlers, RestDeleteIndexTemplateAction.class);
|
||||
registerRestHandler(handlers, RestHeadIndexTemplateAction.class);
|
||||
registerHandler.accept(new RestAnalyzeAction(settings, restController));
|
||||
registerHandler.accept(new RestGetIndexTemplateAction(settings, restController));
|
||||
registerHandler.accept(new RestPutIndexTemplateAction(settings, restController));
|
||||
registerHandler.accept(new RestDeleteIndexTemplateAction(settings, restController));
|
||||
registerHandler.accept(new RestHeadIndexTemplateAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestPutMappingAction.class);
|
||||
registerRestHandler(handlers, RestGetMappingAction.class);
|
||||
registerRestHandler(handlers, RestGetFieldMappingAction.class);
|
||||
registerHandler.accept(new RestPutMappingAction(settings, restController));
|
||||
registerHandler.accept(new RestGetMappingAction(settings, restController));
|
||||
registerHandler.accept(new RestGetFieldMappingAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestRefreshAction.class);
|
||||
registerRestHandler(handlers, RestFlushAction.class);
|
||||
registerRestHandler(handlers, RestSyncedFlushAction.class);
|
||||
registerRestHandler(handlers, RestForceMergeAction.class);
|
||||
registerRestHandler(handlers, RestUpgradeAction.class);
|
||||
registerRestHandler(handlers, RestClearIndicesCacheAction.class);
|
||||
registerHandler.accept(new RestRefreshAction(settings, restController));
|
||||
registerHandler.accept(new RestFlushAction(settings, restController));
|
||||
registerHandler.accept(new RestSyncedFlushAction(settings, restController));
|
||||
registerHandler.accept(new RestForceMergeAction(settings, restController));
|
||||
registerHandler.accept(new RestUpgradeAction(settings, restController));
|
||||
registerHandler.accept(new RestClearIndicesCacheAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestIndexAction.class);
|
||||
registerRestHandler(handlers, RestGetAction.class);
|
||||
registerRestHandler(handlers, RestGetSourceAction.class);
|
||||
registerRestHandler(handlers, RestHeadAction.Document.class);
|
||||
registerRestHandler(handlers, RestHeadAction.Source.class);
|
||||
registerRestHandler(handlers, RestMultiGetAction.class);
|
||||
registerRestHandler(handlers, RestDeleteAction.class);
|
||||
registerRestHandler(handlers, org.elasticsearch.rest.action.document.RestCountAction.class);
|
||||
registerRestHandler(handlers, RestTermVectorsAction.class);
|
||||
registerRestHandler(handlers, RestMultiTermVectorsAction.class);
|
||||
registerRestHandler(handlers, RestBulkAction.class);
|
||||
registerRestHandler(handlers, RestUpdateAction.class);
|
||||
registerHandler.accept(new RestIndexAction(settings, restController));
|
||||
registerHandler.accept(new RestGetAction(settings, restController));
|
||||
registerHandler.accept(new RestGetSourceAction(settings, restController));
|
||||
registerHandler.accept(new RestHeadAction.Document(settings, restController));
|
||||
registerHandler.accept(new RestHeadAction.Source(settings, restController));
|
||||
registerHandler.accept(new RestMultiGetAction(settings, restController));
|
||||
registerHandler.accept(new RestDeleteAction(settings, restController));
|
||||
registerHandler.accept(new org.elasticsearch.rest.action.document.RestCountAction(settings, restController));
|
||||
registerHandler.accept(new RestTermVectorsAction(settings, restController));
|
||||
registerHandler.accept(new RestMultiTermVectorsAction(settings, restController));
|
||||
registerHandler.accept(new RestBulkAction(settings, restController));
|
||||
registerHandler.accept(new RestUpdateAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestSearchAction.class);
|
||||
registerRestHandler(handlers, RestSearchScrollAction.class);
|
||||
registerRestHandler(handlers, RestClearScrollAction.class);
|
||||
registerRestHandler(handlers, RestMultiSearchAction.class);
|
||||
registerHandler.accept(new RestSearchAction(settings, restController));
|
||||
registerHandler.accept(new RestSearchScrollAction(settings, restController));
|
||||
registerHandler.accept(new RestClearScrollAction(settings, restController));
|
||||
registerHandler.accept(new RestMultiSearchAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestValidateQueryAction.class);
|
||||
registerHandler.accept(new RestValidateQueryAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestExplainAction.class);
|
||||
registerHandler.accept(new RestExplainAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestRecoveryAction.class);
|
||||
registerHandler.accept(new RestRecoveryAction(settings, restController));
|
||||
|
||||
// Scripts API
|
||||
registerRestHandler(handlers, RestGetStoredScriptAction.class);
|
||||
registerRestHandler(handlers, RestPutStoredScriptAction.class);
|
||||
registerRestHandler(handlers, RestDeleteStoredScriptAction.class);
|
||||
registerHandler.accept(new RestGetStoredScriptAction(settings, restController));
|
||||
registerHandler.accept(new RestPutStoredScriptAction(settings, restController));
|
||||
registerHandler.accept(new RestDeleteStoredScriptAction(settings, restController));
|
||||
|
||||
registerRestHandler(handlers, RestFieldStatsAction.class);
|
||||
registerHandler.accept(new RestFieldStatsAction(settings, restController));
|
||||
|
||||
// Tasks API
|
||||
registerRestHandler(handlers, RestListTasksAction.class);
|
||||
registerRestHandler(handlers, RestGetTaskAction.class);
|
||||
registerRestHandler(handlers, RestCancelTasksAction.class);
|
||||
registerHandler.accept(new RestListTasksAction(settings, restController, nodesInCluster));
|
||||
registerHandler.accept(new RestGetTaskAction(settings, restController));
|
||||
registerHandler.accept(new RestCancelTasksAction(settings, restController, nodesInCluster));
|
||||
|
||||
// Ingest API
|
||||
registerRestHandler(handlers, RestPutPipelineAction.class);
|
||||
registerRestHandler(handlers, RestGetPipelineAction.class);
|
||||
registerRestHandler(handlers, RestDeletePipelineAction.class);
|
||||
registerRestHandler(handlers, RestSimulatePipelineAction.class);
|
||||
registerHandler.accept(new RestPutPipelineAction(settings, restController));
|
||||
registerHandler.accept(new RestGetPipelineAction(settings, restController));
|
||||
registerHandler.accept(new RestDeletePipelineAction(settings, restController));
|
||||
registerHandler.accept(new RestSimulatePipelineAction(settings, restController));
|
||||
|
||||
// CAT API
|
||||
registerRestHandler(handlers, RestCatAction.class);
|
||||
registerRestHandler(handlers, RestAllocationAction.class);
|
||||
registerRestHandler(handlers, RestShardsAction.class);
|
||||
registerRestHandler(handlers, RestMasterAction.class);
|
||||
registerRestHandler(handlers, RestNodesAction.class);
|
||||
registerRestHandler(handlers, RestTasksAction.class);
|
||||
registerRestHandler(handlers, RestIndicesAction.class);
|
||||
registerRestHandler(handlers, RestSegmentsAction.class);
|
||||
registerHandler.accept(new RestAllocationAction(settings, restController));
|
||||
registerHandler.accept(new RestShardsAction(settings, restController));
|
||||
registerHandler.accept(new RestMasterAction(settings, restController));
|
||||
registerHandler.accept(new RestNodesAction(settings, restController));
|
||||
registerHandler.accept(new RestTasksAction(settings, restController, nodesInCluster));
|
||||
registerHandler.accept(new RestIndicesAction(settings, restController, indexNameExpressionResolver));
|
||||
registerHandler.accept(new RestSegmentsAction(settings, restController));
|
||||
// Fully qualified to prevent interference with rest.action.count.RestCountAction
|
||||
registerRestHandler(handlers, org.elasticsearch.rest.action.cat.RestCountAction.class);
|
||||
registerHandler.accept(new org.elasticsearch.rest.action.cat.RestCountAction(settings, restController));
|
||||
// Fully qualified to prevent interference with rest.action.indices.RestRecoveryAction
|
||||
registerRestHandler(handlers, org.elasticsearch.rest.action.cat.RestRecoveryAction.class);
|
||||
registerRestHandler(handlers, RestHealthAction.class);
|
||||
registerRestHandler(handlers, org.elasticsearch.rest.action.cat.RestPendingClusterTasksAction.class);
|
||||
registerRestHandler(handlers, RestAliasAction.class);
|
||||
registerRestHandler(handlers, RestThreadPoolAction.class);
|
||||
registerRestHandler(handlers, RestPluginsAction.class);
|
||||
registerRestHandler(handlers, RestFielddataAction.class);
|
||||
registerRestHandler(handlers, RestNodeAttrsAction.class);
|
||||
registerRestHandler(handlers, RestRepositoriesAction.class);
|
||||
registerRestHandler(handlers, RestSnapshotAction.class);
|
||||
registerRestHandler(handlers, RestTemplatesAction.class);
|
||||
registerHandler.accept(new org.elasticsearch.rest.action.cat.RestRecoveryAction(settings, restController));
|
||||
registerHandler.accept(new RestHealthAction(settings, restController));
|
||||
registerHandler.accept(new org.elasticsearch.rest.action.cat.RestPendingClusterTasksAction(settings, restController));
|
||||
registerHandler.accept(new RestAliasAction(settings, restController));
|
||||
registerHandler.accept(new RestThreadPoolAction(settings, restController));
|
||||
registerHandler.accept(new RestPluginsAction(settings, restController));
|
||||
registerHandler.accept(new RestFielddataAction(settings, restController));
|
||||
registerHandler.accept(new RestNodeAttrsAction(settings, restController));
|
||||
registerHandler.accept(new RestRepositoriesAction(settings, restController));
|
||||
registerHandler.accept(new RestSnapshotAction(settings, restController));
|
||||
registerHandler.accept(new RestTemplatesAction(settings, restController));
|
||||
for (ActionPlugin plugin : actionPlugins) {
|
||||
for (Class<? extends RestHandler> handler : plugin.getRestHandlers()) {
|
||||
registerRestHandler(handlers, handler);
|
||||
for (RestHandler handler : plugin.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings,
|
||||
settingsFilter, indexNameExpressionResolver, nodesInCluster)) {
|
||||
registerHandler.accept(handler);
|
||||
}
|
||||
}
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private static void registerRestHandler(Set<Class<? extends RestHandler>> handlers, Class<? extends RestHandler> handler) {
|
||||
if (handlers.contains(handler)) {
|
||||
throw new IllegalArgumentException("can't register the same [rest_handler] more than once for [" + handler.getName() + "]");
|
||||
}
|
||||
handlers.add(handler);
|
||||
registerHandler.accept(new RestCatAction(settings, restController, catActions));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -654,25 +665,6 @@ public class ActionModule extends AbstractModule {
|
|||
bind(supportAction).asEagerSingleton();
|
||||
}
|
||||
}
|
||||
|
||||
if (restController != null) {
|
||||
// Bind the RestController which is required (by Node) even if rest isn't enabled.
|
||||
bind(RestController.class).toInstance(restController);
|
||||
}
|
||||
|
||||
// Setup the RestHandlers
|
||||
if (NetworkModule.HTTP_ENABLED.get(settings)) {
|
||||
Multibinder<RestHandler> restHandlers = Multibinder.newSetBinder(binder(), RestHandler.class);
|
||||
Multibinder<AbstractCatAction> catHandlers = Multibinder.newSetBinder(binder(), AbstractCatAction.class);
|
||||
for (Class<? extends RestHandler> handler : setupRestHandlers(actionPlugins)) {
|
||||
bind(handler).asEagerSingleton();
|
||||
if (AbstractCatAction.class.isAssignableFrom(handler)) {
|
||||
catHandlers.addBinding().to(handler.asSubclass(AbstractCatAction.class));
|
||||
} else {
|
||||
restHandlers.addBinding().to(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,8 +159,9 @@ public abstract class TransportClient extends AbstractClient {
|
|||
modules.add(pluginModule);
|
||||
}
|
||||
modules.add(b -> b.bind(ThreadPool.class).toInstance(threadPool));
|
||||
ActionModule actionModule = new ActionModule(true, settings, null, settingsModule.getClusterSettings(),
|
||||
threadPool, pluginsService.filterPlugins(ActionPlugin.class), null, null);
|
||||
ActionModule actionModule = new ActionModule(true, settings, null, settingsModule.getIndexScopedSettings(),
|
||||
settingsModule.getClusterSettings(), settingsModule.getSettingsFilter(), threadPool,
|
||||
pluginsService.filterPlugins(ActionPlugin.class), null, null);
|
||||
modules.add(actionModule);
|
||||
|
||||
CircuitBreakerService circuitBreakerService = Node.createCircuitBreakerService(settingsModule.getSettings(),
|
||||
|
|
|
@ -111,7 +111,10 @@ public class PathTrie<T> {
|
|||
// in case the target(last) node already exist but without a value
|
||||
// than the value should be updated.
|
||||
if (index == (path.length - 1)) {
|
||||
assert (node.value == null || node.value == value);
|
||||
if (node.value != null) {
|
||||
throw new IllegalArgumentException("Path [" + String.join("/", path)+ "] already has a value ["
|
||||
+ node.value + "]");
|
||||
}
|
||||
if (node.value == null) {
|
||||
node.value = value;
|
||||
}
|
||||
|
@ -190,6 +193,9 @@ public class PathTrie<T> {
|
|||
public void insert(String path, T value) {
|
||||
String[] strings = path.split(SEPARATOR);
|
||||
if (strings.length == 0) {
|
||||
if (rootValue != null) {
|
||||
throw new IllegalArgumentException("Path [/] already has a value [" + rootValue + "]");
|
||||
}
|
||||
rootValue = value;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -221,5 +221,7 @@ public class SettingsModule implements Module {
|
|||
return clusterSettings;
|
||||
}
|
||||
|
||||
public SettingsFilter getSettingsFilter() { return settingsFilter; }
|
||||
public SettingsFilter getSettingsFilter() {
|
||||
return settingsFilter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -355,8 +355,8 @@ public class Node implements Closeable {
|
|||
settingsModule.getClusterSettings());
|
||||
resourcesToClose.add(circuitBreakerService);
|
||||
ActionModule actionModule = new ActionModule(false, settings, clusterModule.getIndexNameExpressionResolver(),
|
||||
settingsModule.getClusterSettings(), threadPool, pluginsService.filterPlugins(ActionPlugin.class), client,
|
||||
circuitBreakerService);
|
||||
settingsModule.getIndexScopedSettings(), settingsModule.getClusterSettings(), settingsModule.getSettingsFilter(),
|
||||
threadPool, pluginsService.filterPlugins(ActionPlugin.class), client, circuitBreakerService);
|
||||
modules.add(actionModule);
|
||||
modules.add(new GatewayModule());
|
||||
|
||||
|
@ -484,6 +484,10 @@ public class Node implements Closeable {
|
|||
client.initialize(injector.getInstance(new Key<Map<GenericAction, TransportAction>>() {}),
|
||||
() -> clusterService.localNode().getId());
|
||||
|
||||
if (NetworkModule.HTTP_ENABLED.get(settings)) {
|
||||
logger.debug("initializing HTTP handlers ...");
|
||||
actionModule.initRestHandlers(() -> clusterService.state().nodes());
|
||||
}
|
||||
logger.info("initialized");
|
||||
|
||||
success = true;
|
||||
|
|
|
@ -25,14 +25,23 @@ import org.elasticsearch.action.GenericAction;
|
|||
import org.elasticsearch.action.support.ActionFilter;
|
||||
import org.elasticsearch.action.support.TransportAction;
|
||||
import org.elasticsearch.action.support.TransportActions;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
/**
|
||||
|
@ -63,7 +72,9 @@ public interface ActionPlugin {
|
|||
/**
|
||||
* Rest handlers added by this plugin.
|
||||
*/
|
||||
default List<Class<? extends RestHandler>> getRestHandlers() {
|
||||
default List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
|
||||
IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.action.fieldstats.FieldStatsResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
@ -44,8 +43,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestFieldStatsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestFieldStatsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_field_stats", this);
|
||||
|
|
|
@ -23,8 +23,6 @@ import org.elasticsearch.action.main.MainAction;
|
|||
import org.elasticsearch.action.main.MainRequest;
|
||||
import org.elasticsearch.action.main.MainResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -40,8 +38,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.HEAD;
|
||||
|
||||
public class RestMainAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestMainAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/", this);
|
||||
|
|
|
@ -21,9 +21,8 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -31,18 +30,18 @@ import org.elasticsearch.rest.RestRequest;
|
|||
import org.elasticsearch.tasks.TaskId;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||
import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.listTasksResponseListener;
|
||||
|
||||
|
||||
public class RestCancelTasksAction extends BaseRestHandler {
|
||||
private final ClusterService clusterService;
|
||||
private final Supplier<DiscoveryNodes> nodesInCluster;
|
||||
|
||||
@Inject
|
||||
public RestCancelTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
|
||||
public RestCancelTasksAction(Settings settings, RestController controller, Supplier<DiscoveryNodes> nodesInCluster) {
|
||||
super(settings);
|
||||
this.clusterService = clusterService;
|
||||
this.nodesInCluster = nodesInCluster;
|
||||
controller.registerHandler(POST, "/_tasks/_cancel", this);
|
||||
controller.registerHandler(POST, "/_tasks/{task_id}/_cancel", this);
|
||||
}
|
||||
|
@ -61,7 +60,7 @@ public class RestCancelTasksAction extends BaseRestHandler {
|
|||
cancelTasksRequest.setActions(actions);
|
||||
cancelTasksRequest.setParentTaskId(parentTaskId);
|
||||
return channel ->
|
||||
client.admin().cluster().cancelTasks(cancelTasksRequest, listTasksResponseListener(clusterService, groupBy, channel));
|
||||
client.admin().cluster().cancelTasks(cancelTasksRequest, listTasksResponseListener(nodesInCluster, groupBy, channel));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplai
|
|||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -43,8 +42,6 @@ import java.io.IOException;
|
|||
* Class handling cluster allocation explanation at the REST level
|
||||
*/
|
||||
public class RestClusterAllocationExplainAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterAllocationExplainAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/allocation/explain", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
|||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
|
@ -46,7 +45,6 @@ public class RestClusterGetSettingsAction extends BaseRestHandler {
|
|||
private final ClusterSettings clusterSettings;
|
||||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestClusterGetSettingsAction(Settings settings, RestController controller, ClusterSettings clusterSettings,
|
||||
SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.client.node.NodeClient;
|
|||
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -40,8 +39,6 @@ import java.util.Set;
|
|||
import static org.elasticsearch.client.Requests.clusterHealthRequest;
|
||||
|
||||
public class RestClusterHealthAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterHealthAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.common.xcontent.ObjectParser;
|
||||
|
@ -58,7 +57,6 @@ public class RestClusterRerouteAction extends BaseRestHandler {
|
|||
|
||||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestClusterRerouteAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
this.settingsFilter = settingsFilter;
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -37,8 +36,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||
|
||||
public class RestClusterSearchShardsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterSearchShardsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_search_shards", this);
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.client.Requests;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -48,7 +47,6 @@ public class RestClusterStateAction extends BaseRestHandler {
|
|||
|
||||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestClusterStateAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -31,8 +30,6 @@ import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestClusterStatsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterStatsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequ
|
|||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
@ -37,8 +36,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
public class RestClusterUpdateSettingsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterUpdateSettingsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -38,8 +37,6 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
* Creates a new snapshot
|
||||
*/
|
||||
public class RestCreateSnapshotAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestCreateSnapshotAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -37,8 +36,6 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
|||
* Unregisters a repository
|
||||
*/
|
||||
public class RestDeleteRepositoryAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteRepositoryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(DELETE, "/_snapshot/{repository}", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -37,8 +36,6 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
|||
* Deletes a snapshot
|
||||
*/
|
||||
public class RestDeleteSnapshotAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteSnapshotAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this);
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -32,8 +31,6 @@ import java.io.IOException;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||
|
||||
public class RestDeleteStoredScriptAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteStoredScriptAction(Settings settings, RestController controller) {
|
||||
this(settings, controller, true);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.client.node.NodeClient;
|
|||
import org.elasticsearch.cluster.metadata.RepositoriesMetaData;
|
||||
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -50,7 +49,6 @@ public class RestGetRepositoriesAction extends BaseRestHandler {
|
|||
|
||||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestGetRepositoriesAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_snapshot", this);
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -38,8 +37,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
* Returns information about snapshot
|
||||
*/
|
||||
public class RestGetSnapshotsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetSnapshotsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -37,8 +36,6 @@ import java.io.IOException;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestGetStoredScriptAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetStoredScriptAction(Settings settings, RestController controller) {
|
||||
this(settings, controller, true);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -35,7 +34,6 @@ import java.io.IOException;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestGetTaskAction extends BaseRestHandler {
|
||||
@Inject
|
||||
public RestGetTaskAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_tasks/{taskId}", this);
|
||||
|
|
|
@ -23,9 +23,8 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -41,18 +40,18 @@ import org.elasticsearch.rest.action.RestToXContentListener;
|
|||
import org.elasticsearch.tasks.TaskId;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
|
||||
public class RestListTasksAction extends BaseRestHandler {
|
||||
|
||||
private final ClusterService clusterService;
|
||||
private final Supplier<DiscoveryNodes> nodesInCluster;
|
||||
|
||||
@Inject
|
||||
public RestListTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
|
||||
public RestListTasksAction(Settings settings, RestController controller, Supplier<DiscoveryNodes> nodesInCluster) {
|
||||
super(settings);
|
||||
this.clusterService = clusterService;
|
||||
this.nodesInCluster = nodesInCluster;
|
||||
controller.registerHandler(GET, "/_tasks", this);
|
||||
}
|
||||
|
||||
|
@ -60,7 +59,8 @@ public class RestListTasksAction extends BaseRestHandler {
|
|||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
|
||||
final ListTasksRequest listTasksRequest = generateListTasksRequest(request);
|
||||
final String groupBy = request.param("group_by", "nodes");
|
||||
return channel -> client.admin().cluster().listTasks(listTasksRequest, listTasksResponseListener(clusterService, groupBy, channel));
|
||||
return channel -> client.admin().cluster().listTasks(listTasksRequest,
|
||||
listTasksResponseListener(nodesInCluster, groupBy, channel));
|
||||
}
|
||||
|
||||
public static ListTasksRequest generateListTasksRequest(RestRequest request) {
|
||||
|
@ -85,15 +85,15 @@ public class RestListTasksAction extends BaseRestHandler {
|
|||
* Standard listener for extensions of {@link ListTasksResponse} that supports {@code group_by=nodes}.
|
||||
*/
|
||||
public static <T extends ListTasksResponse> ActionListener<T> listTasksResponseListener(
|
||||
ClusterService clusterService,
|
||||
String groupBy,
|
||||
final RestChannel channel) {
|
||||
Supplier<DiscoveryNodes> nodesInCluster,
|
||||
String groupBy,
|
||||
final RestChannel channel) {
|
||||
if ("nodes".equals(groupBy)) {
|
||||
return new RestBuilderListener<T>(channel) {
|
||||
@Override
|
||||
public RestResponse buildResponse(T response, XContentBuilder builder) throws Exception {
|
||||
builder.startObject();
|
||||
response.toXContentGroupedByNode(builder, channel.request(), clusterService.state().nodes());
|
||||
response.toXContentGroupedByNode(builder, channel.request(), nodesInCluster.get());
|
||||
builder.endObject();
|
||||
return new BytesRestResponse(RestStatus.OK, builder);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsReq
|
|||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -39,8 +38,6 @@ import java.io.IOException;
|
|||
|
||||
|
||||
public class RestNodesHotThreadsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestNodesHotThreadsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hotthreads", this);
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
|
@ -51,7 +50,6 @@ public class RestNodesInfoAction extends BaseRestHandler {
|
|||
|
||||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestNodesInfoAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_nodes", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
|||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -43,8 +42,6 @@ import java.util.function.Consumer;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestNodesStatsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestNodesStatsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_nodes/stats", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -31,8 +30,6 @@ import org.elasticsearch.rest.action.RestToXContentListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestPendingClusterTasksAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestPendingClusterTasksAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -39,8 +38,6 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
* Registers repositories
|
||||
*/
|
||||
public class RestPutRepositoryAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestPutRepositoryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(PUT, "/_snapshot/{repository}", this);
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -33,8 +32,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||
|
||||
public class RestPutStoredScriptAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestPutStoredScriptAction(Settings settings, RestController controller) {
|
||||
this(settings, controller, true);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -37,8 +36,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
* Restores a snapshot
|
||||
*/
|
||||
public class RestRestoreSnapshotAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestRestoreSnapshotAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this);
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -38,8 +37,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
* Returns status of currently running snapshot
|
||||
*/
|
||||
public class RestSnapshotsStatusAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestSnapshotsStatusAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}/_status", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -34,8 +33,6 @@ import static org.elasticsearch.client.Requests.verifyRepositoryRequest;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||
|
||||
public class RestVerifyRepositoryAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestVerifyRepositoryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_snapshot/{repository}/_verify", this);
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
|
@ -41,8 +40,6 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestAliasesExistAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestAliasesExistAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(HEAD, "/_alias/{name}", this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.admin.indices;
|
|||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -49,7 +48,6 @@ public class RestAnalyzeAction extends BaseRestHandler {
|
|||
public static final ParseField ATTRIBUTES = new ParseField("attributes");
|
||||
}
|
||||
|
||||
@Inject
|
||||
public RestAnalyzeAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_analyze", this);
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -44,8 +43,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestClearIndicesCacheAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClearIndicesCacheAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_cache/clear", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -33,8 +32,6 @@ import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestCloseIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestCloseIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/_close", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
|||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -34,8 +33,6 @@ import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestCreateIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestCreateIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -33,8 +32,6 @@ import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestDeleteIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.DELETE, "/", this);
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.rest.action.admin.indices;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -30,8 +29,6 @@ import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestDeleteIndexTemplateAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteIndexTemplateAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -42,8 +41,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestFlushAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestFlushAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_flush", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -41,8 +40,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestForceMergeAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestForceMergeAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_forcemerge", this);
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
package org.elasticsearch.rest.action.admin.indices;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -46,8 +46,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestGetAliasesAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetAliasesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_alias/{name}", this);
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRespon
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -44,8 +43,6 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestGetFieldMappingAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetFieldMappingAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_mapping/field/{fields}", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequ
|
|||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -39,8 +38,6 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestGetIndexTemplateAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetIndexTemplateAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.elasticsearch.rest.action.admin.indices;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
|
||||
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
|
||||
|
@ -28,7 +29,6 @@ import org.elasticsearch.cluster.metadata.AliasMetaData;
|
|||
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
|
@ -53,7 +53,6 @@ public class RestGetIndicesAction extends BaseRestHandler {
|
|||
private final IndexScopedSettings indexScopedSettings;
|
||||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestGetIndicesAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings,
|
||||
SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.rest.action.admin.indices;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
|
@ -27,7 +28,6 @@ import org.elasticsearch.client.node.NodeClient;
|
|||
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
|
@ -45,8 +45,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestGetMappingAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetMappingAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/{index}/{type}/_mapping", this);
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
package org.elasticsearch.rest.action.admin.indices;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
|
@ -47,7 +47,6 @@ public class RestGetSettingsAction extends BaseRestHandler {
|
|||
private final IndexScopedSettings indexScopedSettings;
|
||||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestGetSettingsAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings,
|
||||
final SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequ
|
|||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
|
@ -39,8 +38,6 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestHeadIndexTemplateAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestHeadIndexTemplateAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
|||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -34,8 +33,6 @@ import java.io.IOException;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||
|
||||
public class RestIndexDeleteAliasesAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndexDeleteAliasesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(DELETE, "/{index}/_alias/{name}", this);
|
||||
|
|
|
@ -22,9 +22,7 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
|||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -38,8 +36,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||
|
||||
public class RestIndexPutAliasAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndexPutAliasAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(PUT, "/{index}/_alias/{name}", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
|||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.ObjectParser;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
@ -46,7 +45,6 @@ public class RestIndicesAliasesAction extends BaseRestHandler {
|
|||
}, AliasActions.PARSER, new ParseField("actions"));
|
||||
}
|
||||
|
||||
@Inject
|
||||
public RestIndicesAliasesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_aliases", this);
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
|
@ -41,8 +40,6 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestIndicesExistsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesExistsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(HEAD, "/{index}", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -41,8 +40,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestIndicesSegmentsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesSegmentsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_segments", this);
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -44,8 +43,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
* Rest action for {@link IndicesShardStoresAction}
|
||||
*/
|
||||
public class RestIndicesShardStoresAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesShardStoresAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_shard_stores", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -48,8 +47,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestIndicesStatsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesStatsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_stats", this);
|
||||
|
@ -58,7 +55,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
controller.registerHandler(GET, "/{index}/_stats/{metric}", this);
|
||||
}
|
||||
|
||||
static Map<String, Consumer<IndicesStatsRequest>> METRICS;
|
||||
static final Map<String, Consumer<IndicesStatsRequest>> METRICS;
|
||||
|
||||
static {
|
||||
final Map<String, Consumer<IndicesStatsRequest>> metrics = new HashMap<>();
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -34,8 +33,6 @@ import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestOpenIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestOpenIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/_open", this);
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.rest.action.admin.indices;
|
|||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -39,7 +38,6 @@ public class RestPutIndexTemplateAction extends BaseRestHandler {
|
|||
|
||||
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(RestPutIndexTemplateAction.class));
|
||||
|
||||
@Inject
|
||||
public RestPutIndexTemplateAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/_template/{name}", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -38,9 +37,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||
|
||||
public class RestPutMappingAction extends BaseRestHandler {
|
||||
|
||||
|
||||
@Inject
|
||||
public RestPutMappingAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(PUT, "/{index}/_mapping/", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -43,8 +42,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
* REST handler to report on index recoveries.
|
||||
*/
|
||||
public class RestRecoveryAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestRecoveryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_recovery", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -42,8 +41,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestRefreshAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestRefreshAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_refresh", this);
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.rest.action.admin.indices;
|
|||
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -32,8 +31,6 @@ import org.elasticsearch.rest.action.RestToXContentListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestRolloverIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestRolloverIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.shrink.ShrinkRequest;
|
|||
import org.elasticsearch.action.admin.indices.shrink.ShrinkResponse;
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -34,8 +33,6 @@ import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
|||
import java.io.IOException;
|
||||
|
||||
public class RestShrinkIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestShrinkIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_shrink/{target}", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.flush.SyncedFlushResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -40,8 +39,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||
|
||||
public class RestSyncedFlushAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestSyncedFlushAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_flush/synced", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
|
@ -43,8 +42,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
* Rest api for checking if a type exists.
|
||||
*/
|
||||
public class RestTypesExistsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestTypesExistsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -50,7 +49,6 @@ public class RestUpdateSettingsAction extends BaseRestHandler {
|
|||
"ignore_unavailable",
|
||||
"allow_no_indices"));
|
||||
|
||||
@Inject
|
||||
public RestUpdateSettingsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_settings", this);
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -47,8 +46,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestUpgradeAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestUpgradeAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_upgrade", this);
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -46,7 +45,6 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader;
|
||||
|
||||
public class RestValidateQueryAction extends BaseRestHandler {
|
||||
@Inject
|
||||
public RestValidateQueryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_validate/query", this);
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
package org.elasticsearch.rest.action.cat;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
|
@ -37,15 +37,12 @@ import java.util.List;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestAliasAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestAliasAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/aliases", this);
|
||||
controller.registerHandler(GET, "/_cat/aliases/{alias}", this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
|
||||
final GetAliasesRequest getAliasesRequest = request.hasParam("alias") ?
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.rest.action.cat;
|
||||
|
||||
import com.carrotsearch.hppc.ObjectIntScatterMap;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||
|
@ -31,7 +32,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -44,8 +44,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
|
||||
|
||||
public class RestAllocationAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestAllocationAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/allocation", this);
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.rest.RestRequest;
|
|||
import org.elasticsearch.rest.RestStatus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class RestCatAction extends BaseRestHandler {
|
|||
private final String HELP;
|
||||
|
||||
@Inject
|
||||
public RestCatAction(Settings settings, RestController controller, Set<AbstractCatAction> catActions) {
|
||||
public RestCatAction(Settings settings, RestController controller, List<AbstractCatAction> catActions) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat", this);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -40,8 +39,7 @@ import java.io.IOException;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestCountAction extends AbstractCatAction {
|
||||
@Inject
|
||||
public RestCountAction(Settings settings, RestController restController, RestController controller) {
|
||||
public RestCountAction(Settings settings, RestController restController) {
|
||||
super(settings);
|
||||
restController.registerHandler(GET, "/_cat/count", this);
|
||||
restController.registerHandler(GET, "/_cat/count/{index}", this);
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
package org.elasticsearch.rest.action.cat;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.ObjectLongCursor;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -39,8 +39,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
* Cat API class to display information about the size of fielddata fields per node
|
||||
*/
|
||||
public class RestFielddataAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestFielddataAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/fielddata", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
|||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
|
@ -35,8 +34,6 @@ import java.util.Locale;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestHealthAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestHealthAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/health", this);
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
|||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -60,7 +59,6 @@ public class RestIndicesAction extends AbstractCatAction {
|
|||
|
||||
private final IndexNameExpressionResolver indexNameExpressionResolver;
|
||||
|
||||
@Inject
|
||||
public RestIndicesAction(Settings settings, RestController controller, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(settings);
|
||||
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.client.node.NodeClient;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
|
@ -35,8 +34,6 @@ import org.elasticsearch.rest.action.RestResponseListener;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestMasterAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestMasterAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/master", this);
|
||||
|
|
|
@ -29,9 +29,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.rest.RestResponse;
|
||||
|
@ -43,8 +41,6 @@ import java.util.Map;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestNodeAttrsAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestNodeAttrsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/nodeattrs", this);
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
|
@ -67,8 +66,6 @@ import java.util.stream.Collectors;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestNodesAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestNodesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/nodes", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.service.PendingClusterTask;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
|
@ -34,7 +33,6 @@ import org.elasticsearch.rest.action.RestResponseListener;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestPendingClusterTasksAction extends AbstractCatAction {
|
||||
@Inject
|
||||
public RestPendingClusterTasksAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/pending_tasks", this);
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.client.node.NodeClient;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.PluginInfo;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -40,8 +39,6 @@ import org.elasticsearch.rest.action.RestResponseListener;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestPluginsAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestPluginsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/plugins", this);
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.cluster.routing.RecoverySource;
|
|||
import org.elasticsearch.cluster.routing.RecoverySource.SnapshotRecoverySource;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.indices.recovery.RecoveryState;
|
||||
|
@ -49,9 +48,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
* be specified to limit output to a particular index or indices.
|
||||
*/
|
||||
public class RestRecoveryAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestRecoveryAction(Settings settings, RestController restController, RestController controller) {
|
||||
public RestRecoveryAction(Settings settings, RestController restController) {
|
||||
super(settings);
|
||||
restController.registerHandler(GET, "/_cat/recovery", this);
|
||||
restController.registerHandler(GET, "/_cat/recovery/{index}", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRe
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
|
@ -37,7 +36,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
* Cat API class to display information about snapshot repositories
|
||||
*/
|
||||
public class RestRepositoriesAction extends AbstractCatAction {
|
||||
@Inject
|
||||
public RestRepositoriesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/repositories", this);
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.client.node.NodeClient;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.engine.Segment;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -45,8 +44,6 @@ import java.util.Map;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestSegmentsAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestSegmentsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/segments", this);
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.engine.CommitStats;
|
||||
|
@ -47,8 +46,6 @@ import java.util.Locale;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestShardsAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestShardsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/shards", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
|||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -44,7 +43,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
* Cat API class to display information about snapshots
|
||||
*/
|
||||
public class RestSnapshotAction extends AbstractCatAction {
|
||||
@Inject
|
||||
public RestSnapshotAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/snapshots", this);
|
||||
|
|
|
@ -24,12 +24,9 @@ import org.elasticsearch.action.admin.cluster.node.tasks.list.TaskGroup;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
|
@ -44,18 +41,18 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.generateListTasksRequest;
|
||||
|
||||
public class RestTasksAction extends AbstractCatAction {
|
||||
private final ClusterService clusterService;
|
||||
private final Supplier<DiscoveryNodes> nodesInCluster;
|
||||
|
||||
@Inject
|
||||
public RestTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
|
||||
public RestTasksAction(Settings settings, RestController controller, Supplier<DiscoveryNodes> nodesInCluster) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/tasks", this);
|
||||
this.clusterService = clusterService;
|
||||
this.nodesInCluster = nodesInCluster;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,7 +152,7 @@ public class RestTasksAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
private void buildGroups(Table table, boolean fullId, boolean detailed, List<TaskGroup> taskGroups) {
|
||||
DiscoveryNodes discoveryNodes = clusterService.state().nodes();
|
||||
DiscoveryNodes discoveryNodes = nodesInCluster.get();
|
||||
List<TaskGroup> sortedGroups = new ArrayList<>(taskGroups);
|
||||
sortedGroups.sort((o1, o2) -> Long.compare(o1.getTaskInfo().getStartTime(), o2.getTaskInfo().getStartTime()));
|
||||
for (TaskGroup taskGroup : sortedGroups) {
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
package org.elasticsearch.rest.action.cat;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
|
@ -37,7 +37,6 @@ import org.elasticsearch.rest.action.RestResponseListener;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestTemplatesAction extends AbstractCatAction {
|
||||
@Inject
|
||||
public RestTemplatesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/templates", this);
|
||||
|
|
|
@ -31,10 +31,8 @@ import org.elasticsearch.client.node.NodeClient;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.rest.RestResponse;
|
||||
|
@ -53,8 +51,6 @@ import java.util.TreeMap;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
||||
public class RestThreadPoolAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestThreadPoolAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat/thread_pool", this);
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.action.support.ActiveShardCount;
|
|||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -61,7 +60,6 @@ public class RestBulkAction extends BaseRestHandler {
|
|||
|
||||
private final boolean allowExplicitIndex;
|
||||
|
||||
@Inject
|
||||
public RestBulkAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
|
@ -45,7 +44,6 @@ import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHead
|
|||
import static org.elasticsearch.search.internal.SearchContext.DEFAULT_TERMINATE_AFTER;
|
||||
|
||||
public class RestCountAction extends BaseRestHandler {
|
||||
@Inject
|
||||
public RestCountAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_count", this);
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.rest.action.document;
|
|||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.VersionType;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -36,8 +35,6 @@ import java.io.IOException;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||
|
||||
public class RestDeleteAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(DELETE, "/{index}/{type}/{id}", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.get.GetRequest;
|
|||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.VersionType;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -41,8 +40,6 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestGetAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/{index}/{type}/{id}", this);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionRequestValidationException;
|
|||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -41,8 +40,6 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestGetSourceAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetSourceAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/{index}/{type}/{id}/_source", this);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.get.GetResponse;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
|
@ -48,8 +47,6 @@ public abstract class RestHeadAction extends BaseRestHandler {
|
|||
* Handler to check for document existence.
|
||||
*/
|
||||
public static class Document extends RestHeadAction {
|
||||
|
||||
@Inject
|
||||
public Document(Settings settings, RestController controller) {
|
||||
super(settings, false);
|
||||
controller.registerHandler(HEAD, "/{index}/{type}/{id}", this);
|
||||
|
@ -60,8 +57,6 @@ public abstract class RestHeadAction extends BaseRestHandler {
|
|||
* Handler to check for document source existence (may be disabled in the mapping).
|
||||
*/
|
||||
public static class Source extends RestHeadAction {
|
||||
|
||||
@Inject
|
||||
public Source(Settings settings, RestController controller) {
|
||||
super(settings, true);
|
||||
controller.registerHandler(HEAD, "/{index}/{type}/{id}/_source", this);
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.rest.action.document;
|
|||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.VersionType;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -38,8 +37,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||
|
||||
public class RestIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue