Search in sources :

Example 1 with RestController

use of org.elasticsearch.rest.RestController in project elasticsearch by elastic.

the class RestRecoveryActionTests method testRestRecoveryAction.

public void testRestRecoveryAction() {
    final Settings settings = Settings.EMPTY;
    final RestController restController = new RestController(settings, Collections.emptySet(), null, null, null);
    final RestRecoveryAction action = new RestRecoveryAction(settings, restController);
    final int totalShards = randomIntBetween(1, 32);
    final int successfulShards = Math.max(0, totalShards - randomIntBetween(1, 2));
    final int failedShards = totalShards - successfulShards;
    final boolean detailed = randomBoolean();
    final Map<String, List<RecoveryState>> shardRecoveryStates = new HashMap<>();
    final List<RecoveryState> recoveryStates = new ArrayList<>();
    for (int i = 0; i < successfulShards; i++) {
        final RecoveryState state = mock(RecoveryState.class);
        when(state.getShardId()).thenReturn(new ShardId(new Index("index", "_na_"), i));
        final RecoveryState.Timer timer = mock(RecoveryState.Timer.class);
        when(timer.time()).thenReturn((long) randomIntBetween(1000000, 10 * 1000000));
        when(state.getTimer()).thenReturn(timer);
        when(state.getRecoverySource()).thenReturn(TestShardRouting.randomRecoverySource());
        when(state.getStage()).thenReturn(randomFrom(RecoveryState.Stage.values()));
        final DiscoveryNode sourceNode = randomBoolean() ? mock(DiscoveryNode.class) : null;
        if (sourceNode != null) {
            when(sourceNode.getHostName()).thenReturn(randomAsciiOfLength(8));
        }
        when(state.getSourceNode()).thenReturn(sourceNode);
        final DiscoveryNode targetNode = mock(DiscoveryNode.class);
        when(targetNode.getHostName()).thenReturn(randomAsciiOfLength(8));
        when(state.getTargetNode()).thenReturn(targetNode);
        RecoveryState.Index index = mock(RecoveryState.Index.class);
        final int totalRecoveredFiles = randomIntBetween(1, 64);
        when(index.totalRecoverFiles()).thenReturn(totalRecoveredFiles);
        final int recoveredFileCount = randomIntBetween(0, totalRecoveredFiles);
        when(index.recoveredFileCount()).thenReturn(recoveredFileCount);
        when(index.recoveredFilesPercent()).thenReturn((100f * recoveredFileCount) / totalRecoveredFiles);
        when(index.totalFileCount()).thenReturn(randomIntBetween(totalRecoveredFiles, 2 * totalRecoveredFiles));
        final int totalRecoveredBytes = randomIntBetween(1, 1 << 24);
        when(index.totalRecoverBytes()).thenReturn((long) totalRecoveredBytes);
        final int recoveredBytes = randomIntBetween(0, totalRecoveredBytes);
        when(index.recoveredBytes()).thenReturn((long) recoveredBytes);
        when(index.recoveredBytesPercent()).thenReturn((100f * recoveredBytes) / totalRecoveredBytes);
        when(index.totalRecoverBytes()).thenReturn((long) randomIntBetween(totalRecoveredBytes, 2 * totalRecoveredBytes));
        when(state.getIndex()).thenReturn(index);
        final RecoveryState.Translog translog = mock(RecoveryState.Translog.class);
        final int translogOps = randomIntBetween(0, 1 << 18);
        when(translog.totalOperations()).thenReturn(translogOps);
        final int translogOpsRecovered = randomIntBetween(0, translogOps);
        when(translog.recoveredOperations()).thenReturn(translogOpsRecovered);
        when(translog.recoveredPercent()).thenReturn(translogOps == 0 ? 100f : (100f * translogOpsRecovered / translogOps));
        when(state.getTranslog()).thenReturn(translog);
        recoveryStates.add(state);
    }
    final List<RecoveryState> shuffle = new ArrayList<>(recoveryStates);
    Randomness.shuffle(shuffle);
    shardRecoveryStates.put("index", shuffle);
    final List<ShardOperationFailedException> shardFailures = new ArrayList<>();
    final RecoveryResponse response = new RecoveryResponse(totalShards, successfulShards, failedShards, detailed, shardRecoveryStates, shardFailures);
    final Table table = action.buildRecoveryTable(null, response);
    assertNotNull(table);
    List<Table.Cell> headers = table.getHeaders();
    assertThat(headers.get(0).value, equalTo("index"));
    assertThat(headers.get(1).value, equalTo("shard"));
    assertThat(headers.get(2).value, equalTo("time"));
    assertThat(headers.get(3).value, equalTo("type"));
    assertThat(headers.get(4).value, equalTo("stage"));
    assertThat(headers.get(5).value, equalTo("source_host"));
    assertThat(headers.get(6).value, equalTo("source_node"));
    assertThat(headers.get(7).value, equalTo("target_host"));
    assertThat(headers.get(8).value, equalTo("target_node"));
    assertThat(headers.get(9).value, equalTo("repository"));
    assertThat(headers.get(10).value, equalTo("snapshot"));
    assertThat(headers.get(11).value, equalTo("files"));
    assertThat(headers.get(12).value, equalTo("files_recovered"));
    assertThat(headers.get(13).value, equalTo("files_percent"));
    assertThat(headers.get(14).value, equalTo("files_total"));
    assertThat(headers.get(15).value, equalTo("bytes"));
    assertThat(headers.get(16).value, equalTo("bytes_recovered"));
    assertThat(headers.get(17).value, equalTo("bytes_percent"));
    assertThat(headers.get(18).value, equalTo("bytes_total"));
    assertThat(headers.get(19).value, equalTo("translog_ops"));
    assertThat(headers.get(20).value, equalTo("translog_ops_recovered"));
    assertThat(headers.get(21).value, equalTo("translog_ops_percent"));
    assertThat(table.getRows().size(), equalTo(successfulShards));
    for (int i = 0; i < successfulShards; i++) {
        final RecoveryState state = recoveryStates.get(i);
        List<Table.Cell> cells = table.getRows().get(i);
        assertThat(cells.get(0).value, equalTo("index"));
        assertThat(cells.get(1).value, equalTo(i));
        assertThat(cells.get(2).value, equalTo(new TimeValue(state.getTimer().time())));
        assertThat(cells.get(3).value, equalTo(state.getRecoverySource().getType().name().toLowerCase(Locale.ROOT)));
        assertThat(cells.get(4).value, equalTo(state.getStage().name().toLowerCase(Locale.ROOT)));
        assertThat(cells.get(5).value, equalTo(state.getSourceNode() == null ? "n/a" : state.getSourceNode().getHostName()));
        assertThat(cells.get(6).value, equalTo(state.getSourceNode() == null ? "n/a" : state.getSourceNode().getName()));
        assertThat(cells.get(7).value, equalTo(state.getTargetNode().getHostName()));
        assertThat(cells.get(8).value, equalTo(state.getTargetNode().getName()));
        assertThat(cells.get(9).value, equalTo(state.getRecoverySource() == null || state.getRecoverySource().getType() != RecoverySource.Type.SNAPSHOT ? "n/a" : ((SnapshotRecoverySource) state.getRecoverySource()).snapshot().getRepository()));
        assertThat(cells.get(10).value, equalTo(state.getRecoverySource() == null || state.getRecoverySource().getType() != RecoverySource.Type.SNAPSHOT ? "n/a" : ((SnapshotRecoverySource) state.getRecoverySource()).snapshot().getSnapshotId().getName()));
        assertThat(cells.get(11).value, equalTo(state.getIndex().totalRecoverFiles()));
        assertThat(cells.get(12).value, equalTo(state.getIndex().recoveredFileCount()));
        assertThat(cells.get(13).value, equalTo(percent(state.getIndex().recoveredFilesPercent())));
        assertThat(cells.get(14).value, equalTo(state.getIndex().totalFileCount()));
        assertThat(cells.get(15).value, equalTo(state.getIndex().totalRecoverBytes()));
        assertThat(cells.get(16).value, equalTo(state.getIndex().recoveredBytes()));
        assertThat(cells.get(17).value, equalTo(percent(state.getIndex().recoveredBytesPercent())));
        assertThat(cells.get(18).value, equalTo(state.getIndex().totalBytes()));
        assertThat(cells.get(19).value, equalTo(state.getTranslog().totalOperations()));
        assertThat(cells.get(20).value, equalTo(state.getTranslog().recoveredOperations()));
        assertThat(cells.get(21).value, equalTo(percent(state.getTranslog().recoveredPercent())));
    }
}
Also used : DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RestController(org.elasticsearch.rest.RestController) Index(org.elasticsearch.index.Index) RecoveryResponse(org.elasticsearch.action.admin.indices.recovery.RecoveryResponse) ShardId(org.elasticsearch.index.shard.ShardId) ArrayList(java.util.ArrayList) List(java.util.List) ShardOperationFailedException(org.elasticsearch.action.ShardOperationFailedException) RecoveryState(org.elasticsearch.indices.recovery.RecoveryState) Settings(org.elasticsearch.common.settings.Settings) TimeValue(org.elasticsearch.common.unit.TimeValue) Table(org.elasticsearch.common.Table) SnapshotRecoverySource(org.elasticsearch.cluster.routing.RecoverySource.SnapshotRecoverySource)

Example 2 with RestController

use of org.elasticsearch.rest.RestController in project elasticsearch by elastic.

the class ActionModule method initRestHandlers.

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));
    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 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));
    registerHandler.accept(new RestUpdateSettingsAction(settings, restController));
    registerHandler.accept(new RestGetSettingsAction(settings, restController, indexScopedSettings, settingsFilter));
    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 RestPutMappingAction(settings, restController));
    registerHandler.accept(new RestGetMappingAction(settings, restController));
    registerHandler.accept(new RestGetFieldMappingAction(settings, restController));
    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));
    registerHandler.accept(new RestIndexAction(settings, restController));
    registerHandler.accept(new RestGetAction(settings, restController));
    registerHandler.accept(new RestGetSourceAction(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));
    registerHandler.accept(new RestSearchAction(settings, restController));
    registerHandler.accept(new RestSearchScrollAction(settings, restController));
    registerHandler.accept(new RestClearScrollAction(settings, restController));
    registerHandler.accept(new RestMultiSearchAction(settings, restController));
    registerHandler.accept(new RestValidateQueryAction(settings, restController));
    registerHandler.accept(new RestExplainAction(settings, restController));
    registerHandler.accept(new RestRecoveryAction(settings, restController));
    // Scripts API
    registerHandler.accept(new RestGetStoredScriptAction(settings, restController));
    registerHandler.accept(new RestPutStoredScriptAction(settings, restController));
    registerHandler.accept(new RestDeleteStoredScriptAction(settings, restController));
    registerHandler.accept(new RestFieldStatsAction(settings, restController));
    // Tasks API
    registerHandler.accept(new RestListTasksAction(settings, restController, nodesInCluster));
    registerHandler.accept(new RestGetTaskAction(settings, restController));
    registerHandler.accept(new RestCancelTasksAction(settings, restController, nodesInCluster));
    // Ingest API
    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
    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
    registerHandler.accept(new org.elasticsearch.rest.action.cat.RestCountAction(settings, restController));
    // Fully qualified to prevent interference with rest.action.indices.RestRecoveryAction
    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 (RestHandler handler : plugin.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings, settingsFilter, indexNameExpressionResolver, nodesInCluster)) {
            registerHandler.accept(handler);
        }
    }
    registerHandler.accept(new RestCatAction(settings, restController, catActions));
}
Also used : RestClusterSearchShardsAction(org.elasticsearch.rest.action.admin.cluster.RestClusterSearchShardsAction) RestTasksAction(org.elasticsearch.rest.action.cat.RestTasksAction) Collections.unmodifiableList(java.util.Collections.unmodifiableList) CreateSnapshotAction(org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotAction) ListTasksAction(org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksAction) TransportTermVectorsAction(org.elasticsearch.action.termvectors.TransportTermVectorsAction) TransportSearchAction(org.elasticsearch.action.search.TransportSearchAction) TransportVerifyRepositoryAction(org.elasticsearch.action.admin.cluster.repositories.verify.TransportVerifyRepositoryAction) UpgradeAction(org.elasticsearch.action.admin.indices.upgrade.post.UpgradeAction) TransportCreateSnapshotAction(org.elasticsearch.action.admin.cluster.snapshots.create.TransportCreateSnapshotAction) TransportUpdateSettingsAction(org.elasticsearch.action.admin.indices.settings.put.TransportUpdateSettingsAction) RestPutPipelineAction(org.elasticsearch.rest.action.ingest.RestPutPipelineAction) DeletePipelineTransportAction(org.elasticsearch.action.ingest.DeletePipelineTransportAction) RestPluginsAction(org.elasticsearch.rest.action.cat.RestPluginsAction) TransportFieldStatsAction(org.elasticsearch.action.fieldstats.TransportFieldStatsAction) RestOpenIndexAction(org.elasticsearch.rest.action.admin.indices.RestOpenIndexAction) TransportGetTaskAction(org.elasticsearch.action.admin.cluster.node.tasks.get.TransportGetTaskAction) GetMappingsAction(org.elasticsearch.action.admin.indices.mapping.get.GetMappingsAction) Map(java.util.Map) PutStoredScriptAction(org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptAction) MultiGetAction(org.elasticsearch.action.get.MultiGetAction) TransportClearIndicesCacheAction(org.elasticsearch.action.admin.indices.cache.clear.TransportClearIndicesCacheAction) TransportListTasksAction(org.elasticsearch.action.admin.cluster.node.tasks.list.TransportListTasksAction) NodesStatsAction(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsAction) TransportAnalyzeAction(org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction) TransportNodesInfoAction(org.elasticsearch.action.admin.cluster.node.info.TransportNodesInfoAction) TransportUpgradeSettingsAction(org.elasticsearch.action.admin.indices.upgrade.post.TransportUpgradeSettingsAction) ActionFilters(org.elasticsearch.action.support.ActionFilters) GetStoredScriptAction(org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptAction) AbstractModule(org.elasticsearch.common.inject.AbstractModule) RestGetAliasesAction(org.elasticsearch.rest.action.admin.indices.RestGetAliasesAction) NamedRegistry(org.elasticsearch.common.NamedRegistry) Logger(org.apache.logging.log4j.Logger) RestBulkAction(org.elasticsearch.rest.action.document.RestBulkAction) RestDeleteAction(org.elasticsearch.rest.action.document.RestDeleteAction) TransportUpdateAction(org.elasticsearch.action.update.TransportUpdateAction) RestIndicesAction(org.elasticsearch.rest.action.cat.RestIndicesAction) TransportShrinkAction(org.elasticsearch.action.admin.indices.shrink.TransportShrinkAction) RestSimulatePipelineAction(org.elasticsearch.rest.action.ingest.RestSimulatePipelineAction) TransportMainAction(org.elasticsearch.action.main.TransportMainAction) TransportNodesStatsAction(org.elasticsearch.action.admin.cluster.node.stats.TransportNodesStatsAction) TransportGetRepositoriesAction(org.elasticsearch.action.admin.cluster.repositories.get.TransportGetRepositoriesAction) TransportUpgradeAction(org.elasticsearch.action.admin.indices.upgrade.post.TransportUpgradeAction) RestTypesExistsAction(org.elasticsearch.rest.action.admin.indices.RestTypesExistsAction) RestSearchAction(org.elasticsearch.rest.action.search.RestSearchAction) RestValidateQueryAction(org.elasticsearch.rest.action.admin.indices.RestValidateQueryAction) TransportShardBulkAction(org.elasticsearch.action.bulk.TransportShardBulkAction) MultiSearchAction(org.elasticsearch.action.search.MultiSearchAction) TransportShardMultiTermsVectorAction(org.elasticsearch.action.termvectors.TransportShardMultiTermsVectorAction) RestSyncedFlushAction(org.elasticsearch.rest.action.admin.indices.RestSyncedFlushAction) DeleteRepositoryAction(org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryAction) Supplier(java.util.function.Supplier) GetTaskAction(org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskAction) TransportRolloverAction(org.elasticsearch.action.admin.indices.rollover.TransportRolloverAction) TransportGetIndexTemplatesAction(org.elasticsearch.action.admin.indices.template.get.TransportGetIndexTemplatesAction) RestClearScrollAction(org.elasticsearch.rest.action.search.RestClearScrollAction) RestDeletePipelineAction(org.elasticsearch.rest.action.ingest.RestDeletePipelineAction) TransportDeleteSnapshotAction(org.elasticsearch.action.admin.cluster.snapshots.delete.TransportDeleteSnapshotAction) RestClusterRerouteAction(org.elasticsearch.rest.action.admin.cluster.RestClusterRerouteAction) RestUpdateSettingsAction(org.elasticsearch.rest.action.admin.indices.RestUpdateSettingsAction) GetFieldMappingsAction(org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsAction) RestGetMappingAction(org.elasticsearch.rest.action.admin.indices.RestGetMappingAction) IndicesStatsAction(org.elasticsearch.action.admin.indices.stats.IndicesStatsAction) RestSegmentsAction(org.elasticsearch.rest.action.cat.RestSegmentsAction) DiscoveryNodes(org.elasticsearch.cluster.node.DiscoveryNodes) RestRestoreSnapshotAction(org.elasticsearch.rest.action.admin.cluster.RestRestoreSnapshotAction) TransportGetStoredScriptAction(org.elasticsearch.action.admin.cluster.storedscripts.TransportGetStoredScriptAction) TransportPutStoredScriptAction(org.elasticsearch.action.admin.cluster.storedscripts.TransportPutStoredScriptAction) RestNodesInfoAction(org.elasticsearch.rest.action.admin.cluster.RestNodesInfoAction) ShrinkAction(org.elasticsearch.action.admin.indices.shrink.ShrinkAction) IndexAction(org.elasticsearch.action.index.IndexAction) MainAction(org.elasticsearch.action.main.MainAction) RestSnapshotAction(org.elasticsearch.rest.action.cat.RestSnapshotAction) ESLoggerFactory(org.elasticsearch.common.logging.ESLoggerFactory) PutPipelineAction(org.elasticsearch.action.ingest.PutPipelineAction) UpdateAction(org.elasticsearch.action.update.UpdateAction) RestNodesStatsAction(org.elasticsearch.rest.action.admin.cluster.RestNodesStatsAction) RestNodesAction(org.elasticsearch.rest.action.cat.RestNodesAction) ForceMergeAction(org.elasticsearch.action.admin.indices.forcemerge.ForceMergeAction) ExplainAction(org.elasticsearch.action.explain.ExplainAction) CloseIndexAction(org.elasticsearch.action.admin.indices.close.CloseIndexAction) RestGetSourceAction(org.elasticsearch.rest.action.document.RestGetSourceAction) AnalyzeAction(org.elasticsearch.action.admin.indices.analyze.AnalyzeAction) RestForceMergeAction(org.elasticsearch.rest.action.admin.indices.RestForceMergeAction) AbstractCatAction(org.elasticsearch.rest.action.cat.AbstractCatAction) TransportBulkAction(org.elasticsearch.action.bulk.TransportBulkAction) NodesInfoAction(org.elasticsearch.action.admin.cluster.node.info.NodesInfoAction) TransportGetFieldMappingsIndexAction(org.elasticsearch.action.admin.indices.mapping.get.TransportGetFieldMappingsIndexAction) TransportRefreshAction(org.elasticsearch.action.admin.indices.refresh.TransportRefreshAction) MultiTermVectorsAction(org.elasticsearch.action.termvectors.MultiTermVectorsAction) RestClusterHealthAction(org.elasticsearch.rest.action.admin.cluster.RestClusterHealthAction) AutoCreateIndex(org.elasticsearch.action.support.AutoCreateIndex) TransportUpgradeStatusAction(org.elasticsearch.action.admin.indices.upgrade.get.TransportUpgradeStatusAction) TransportMultiGetAction(org.elasticsearch.action.get.TransportMultiGetAction) Settings(org.elasticsearch.common.settings.Settings) ThreadPool(org.elasticsearch.threadpool.ThreadPool) PutMappingAction(org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction) GetAction(org.elasticsearch.action.get.GetAction) TransportGetAliasesAction(org.elasticsearch.action.admin.indices.alias.get.TransportGetAliasesAction) TransportRecoveryAction(org.elasticsearch.action.admin.indices.recovery.TransportRecoveryAction) RestClusterStateAction(org.elasticsearch.rest.action.admin.cluster.RestClusterStateAction) TransportTypesExistsAction(org.elasticsearch.action.admin.indices.exists.types.TransportTypesExistsAction) ActionFilter(org.elasticsearch.action.support.ActionFilter) RestPutRepositoryAction(org.elasticsearch.rest.action.admin.cluster.RestPutRepositoryAction) ClusterRerouteAction(org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteAction) TermVectorsAction(org.elasticsearch.action.termvectors.TermVectorsAction) Collectors(java.util.stream.Collectors) RestIndicesShardStoresAction(org.elasticsearch.rest.action.admin.indices.RestIndicesShardStoresAction) RestAliasAction(org.elasticsearch.rest.action.cat.RestAliasAction) RestAnalyzeAction(org.elasticsearch.rest.action.admin.indices.RestAnalyzeAction) TransportCreateIndexAction(org.elasticsearch.action.admin.indices.create.TransportCreateIndexAction) TransportForceMergeAction(org.elasticsearch.action.admin.indices.forcemerge.TransportForceMergeAction) CreateIndexAction(org.elasticsearch.action.admin.indices.create.CreateIndexAction) ClearIndicesCacheAction(org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheAction) RolloverAction(org.elasticsearch.action.admin.indices.rollover.RolloverAction) RestGetFieldMappingAction(org.elasticsearch.rest.action.admin.indices.RestGetFieldMappingAction) GetSettingsAction(org.elasticsearch.action.admin.indices.settings.get.GetSettingsAction) RestIndexPutAliasAction(org.elasticsearch.rest.action.admin.indices.RestIndexPutAliasAction) RestTemplatesAction(org.elasticsearch.rest.action.cat.RestTemplatesAction) UpdateSettingsAction(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsAction) TransportPutIndexTemplateAction(org.elasticsearch.action.admin.indices.template.put.TransportPutIndexTemplateAction) RestGetSettingsAction(org.elasticsearch.rest.action.admin.indices.RestGetSettingsAction) TransportIndicesShardStoresAction(org.elasticsearch.action.admin.indices.shards.TransportIndicesShardStoresAction) PutPipelineTransportAction(org.elasticsearch.action.ingest.PutPipelineTransportAction) RefreshAction(org.elasticsearch.action.admin.indices.refresh.RefreshAction) RestSearchScrollAction(org.elasticsearch.rest.action.search.RestSearchScrollAction) TransportRestoreSnapshotAction(org.elasticsearch.action.admin.cluster.snapshots.restore.TransportRestoreSnapshotAction) RestRefreshAction(org.elasticsearch.rest.action.admin.indices.RestRefreshAction) NodeClient(org.elasticsearch.client.node.NodeClient) TransportIndicesSegmentsAction(org.elasticsearch.action.admin.indices.segments.TransportIndicesSegmentsAction) RestExplainAction(org.elasticsearch.rest.action.search.RestExplainAction) TransportFlushAction(org.elasticsearch.action.admin.indices.flush.TransportFlushAction) RestCatAction(org.elasticsearch.rest.action.cat.RestCatAction) RestIndicesSegmentsAction(org.elasticsearch.rest.action.admin.indices.RestIndicesSegmentsAction) DeleteSnapshotAction(org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotAction) RestMultiSearchAction(org.elasticsearch.rest.action.search.RestMultiSearchAction) TransportDeleteAction(org.elasticsearch.action.delete.TransportDeleteAction) RestGetSnapshotsAction(org.elasticsearch.rest.action.admin.cluster.RestGetSnapshotsAction) RestPutIndexTemplateAction(org.elasticsearch.rest.action.admin.indices.RestPutIndexTemplateAction) RestClearIndicesCacheAction(org.elasticsearch.rest.action.admin.indices.RestClearIndicesCacheAction) RestIndicesStatsAction(org.elasticsearch.rest.action.admin.indices.RestIndicesStatsAction) ClusterAllocationExplainAction(org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainAction) GetIndexTemplatesAction(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesAction) IndexScopedSettings(org.elasticsearch.common.settings.IndexScopedSettings) Consumer(java.util.function.Consumer) RestHealthAction(org.elasticsearch.rest.action.cat.RestHealthAction) ClusterSettings(org.elasticsearch.common.settings.ClusterSettings) RestShardsAction(org.elasticsearch.rest.action.cat.RestShardsAction) RestGetIndexTemplateAction(org.elasticsearch.rest.action.admin.indices.RestGetIndexTemplateAction) RestAllocationAction(org.elasticsearch.rest.action.cat.RestAllocationAction) TransportCancelTasksAction(org.elasticsearch.action.admin.cluster.node.tasks.cancel.TransportCancelTasksAction) FlushAction(org.elasticsearch.action.admin.indices.flush.FlushAction) RestCancelTasksAction(org.elasticsearch.rest.action.admin.cluster.RestCancelTasksAction) IndexNameExpressionResolver(org.elasticsearch.cluster.metadata.IndexNameExpressionResolver) ClusterUpdateSettingsAction(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsAction) IndicesExistsAction(org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsAction) TransportGetMappingsAction(org.elasticsearch.action.admin.indices.mapping.get.TransportGetMappingsAction) ValidateQueryAction(org.elasticsearch.action.admin.indices.validate.query.ValidateQueryAction) TransportExplainAction(org.elasticsearch.action.explain.TransportExplainAction) TransportGetAction(org.elasticsearch.action.get.TransportGetAction) UnaryOperator(java.util.function.UnaryOperator) DestructiveOperations(org.elasticsearch.action.support.DestructiveOperations) RestRepositoriesAction(org.elasticsearch.rest.action.cat.RestRepositoriesAction) UpgradeStatusAction(org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusAction) TypesExistsAction(org.elasticsearch.action.admin.indices.exists.types.TypesExistsAction) RestClusterGetSettingsAction(org.elasticsearch.rest.action.admin.cluster.RestClusterGetSettingsAction) TransportAction(org.elasticsearch.action.support.TransportAction) DeleteIndexAction(org.elasticsearch.action.admin.indices.delete.DeleteIndexAction) BulkAction(org.elasticsearch.action.bulk.BulkAction) TransportPendingClusterTasksAction(org.elasticsearch.action.admin.cluster.tasks.TransportPendingClusterTasksAction) TransportIndicesAliasesAction(org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction) TransportIndexAction(org.elasticsearch.action.index.TransportIndexAction) RestRolloverIndexAction(org.elasticsearch.rest.action.admin.indices.RestRolloverIndexAction) TransportMultiSearchAction(org.elasticsearch.action.search.TransportMultiSearchAction) ClusterSearchShardsAction(org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsAction) RestDeleteIndexAction(org.elasticsearch.rest.action.admin.indices.RestDeleteIndexAction) RestPutStoredScriptAction(org.elasticsearch.rest.action.admin.cluster.RestPutStoredScriptAction) TransportCloseIndexAction(org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction) TransportGetSettingsAction(org.elasticsearch.action.admin.indices.settings.get.TransportGetSettingsAction) TransportGetIndexAction(org.elasticsearch.action.admin.indices.get.TransportGetIndexAction) Set(java.util.Set) RestController(org.elasticsearch.rest.RestController) RestTermVectorsAction(org.elasticsearch.rest.action.document.RestTermVectorsAction) TransportIndicesStatsAction(org.elasticsearch.action.admin.indices.stats.TransportIndicesStatsAction) RestGetStoredScriptAction(org.elasticsearch.rest.action.admin.cluster.RestGetStoredScriptAction) RestMultiTermVectorsAction(org.elasticsearch.rest.action.document.RestMultiTermVectorsAction) RestDeleteStoredScriptAction(org.elasticsearch.rest.action.admin.cluster.RestDeleteStoredScriptAction) RestVerifyRepositoryAction(org.elasticsearch.rest.action.admin.cluster.RestVerifyRepositoryAction) TransportSyncedFlushAction(org.elasticsearch.action.admin.indices.flush.TransportSyncedFlushAction) IndicesShardStoresAction(org.elasticsearch.action.admin.indices.shards.IndicesShardStoresAction) RestFielddataAction(org.elasticsearch.rest.action.cat.RestFielddataAction) PutIndexTemplateAction(org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateAction) RestGetTaskAction(org.elasticsearch.rest.action.admin.cluster.RestGetTaskAction) ClusterStatsAction(org.elasticsearch.action.admin.cluster.stats.ClusterStatsAction) TransportOpenIndexAction(org.elasticsearch.action.admin.indices.open.TransportOpenIndexAction) CircuitBreakerService(org.elasticsearch.indices.breaker.CircuitBreakerService) ArrayList(java.util.ArrayList) RestMultiGetAction(org.elasticsearch.rest.action.document.RestMultiGetAction) TransportClusterSearchShardsAction(org.elasticsearch.action.admin.cluster.shards.TransportClusterSearchShardsAction) RestClusterStatsAction(org.elasticsearch.rest.action.admin.cluster.RestClusterStatsAction) RestPutMappingAction(org.elasticsearch.rest.action.admin.indices.RestPutMappingAction) GetPipelineTransportAction(org.elasticsearch.action.ingest.GetPipelineTransportAction) RestRecoveryAction(org.elasticsearch.rest.action.admin.indices.RestRecoveryAction) RestPendingClusterTasksAction(org.elasticsearch.rest.action.admin.cluster.RestPendingClusterTasksAction) UpgradeSettingsAction(org.elasticsearch.action.admin.indices.upgrade.post.UpgradeSettingsAction) CancelTasksAction(org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksAction) RestDeleteIndexTemplateAction(org.elasticsearch.rest.action.admin.indices.RestDeleteIndexTemplateAction) GetAliasesAction(org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction) TransportClearScrollAction(org.elasticsearch.action.search.TransportClearScrollAction) IndicesAliasesAction(org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction) GetRepositoriesAction(org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesAction) TransportClusterAllocationExplainAction(org.elasticsearch.action.admin.cluster.allocation.TransportClusterAllocationExplainAction) RestGetPipelineAction(org.elasticsearch.rest.action.ingest.RestGetPipelineAction) NodesHotThreadsAction(org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsAction) RestCloseIndexAction(org.elasticsearch.rest.action.admin.indices.RestCloseIndexAction) RestClusterAllocationExplainAction(org.elasticsearch.rest.action.admin.cluster.RestClusterAllocationExplainAction) GetPipelineAction(org.elasticsearch.action.ingest.GetPipelineAction) RestCreateSnapshotAction(org.elasticsearch.rest.action.admin.cluster.RestCreateSnapshotAction) RestUpgradeAction(org.elasticsearch.rest.action.admin.indices.RestUpgradeAction) TransportNodesHotThreadsAction(org.elasticsearch.action.admin.cluster.node.hotthreads.TransportNodesHotThreadsAction) RestFieldStatsAction(org.elasticsearch.rest.action.RestFieldStatsAction) RestMasterAction(org.elasticsearch.rest.action.cat.RestMasterAction) TransportLivenessAction(org.elasticsearch.action.admin.cluster.node.liveness.TransportLivenessAction) RestDeleteSnapshotAction(org.elasticsearch.rest.action.admin.cluster.RestDeleteSnapshotAction) TransportDeleteRepositoryAction(org.elasticsearch.action.admin.cluster.repositories.delete.TransportDeleteRepositoryAction) RestIndexDeleteAliasesAction(org.elasticsearch.rest.action.admin.indices.RestIndexDeleteAliasesAction) TransportMultiTermVectorsAction(org.elasticsearch.action.termvectors.TransportMultiTermVectorsAction) TransportSnapshotsStatusAction(org.elasticsearch.action.admin.cluster.snapshots.status.TransportSnapshotsStatusAction) TransportDeleteStoredScriptAction(org.elasticsearch.action.admin.cluster.storedscripts.TransportDeleteStoredScriptAction) RestClusterUpdateSettingsAction(org.elasticsearch.rest.action.admin.cluster.RestClusterUpdateSettingsAction) DeleteStoredScriptAction(org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptAction) RestGetAction(org.elasticsearch.rest.action.document.RestGetAction) Multibinder(org.elasticsearch.common.inject.multibindings.Multibinder) SimulatePipelineTransportAction(org.elasticsearch.action.ingest.SimulatePipelineTransportAction) RestIndicesAliasesAction(org.elasticsearch.rest.action.admin.indices.RestIndicesAliasesAction) TransportSearchScrollAction(org.elasticsearch.action.search.TransportSearchScrollAction) TransportValidateQueryAction(org.elasticsearch.action.admin.indices.validate.query.TransportValidateQueryAction) RestNodesHotThreadsAction(org.elasticsearch.rest.action.admin.cluster.RestNodesHotThreadsAction) IndicesSegmentsAction(org.elasticsearch.action.admin.indices.segments.IndicesSegmentsAction) DeleteIndexTemplateAction(org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateAction) SimulatePipelineAction(org.elasticsearch.action.ingest.SimulatePipelineAction) SyncedFlushAction(org.elasticsearch.action.admin.indices.flush.SyncedFlushAction) GetSnapshotsAction(org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsAction) RestUpdateAction(org.elasticsearch.rest.action.document.RestUpdateAction) PutRepositoryAction(org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryAction) RestShrinkIndexAction(org.elasticsearch.rest.action.admin.indices.RestShrinkIndexAction) RecoveryAction(org.elasticsearch.action.admin.indices.recovery.RecoveryAction) RestMainAction(org.elasticsearch.rest.action.RestMainAction) FieldStatsAction(org.elasticsearch.action.fieldstats.FieldStatsAction) GetIndexAction(org.elasticsearch.action.admin.indices.get.GetIndexAction) TransportDeleteIndexAction(org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction) RestThreadPoolAction(org.elasticsearch.rest.action.cat.RestThreadPoolAction) OpenIndexAction(org.elasticsearch.action.admin.indices.open.OpenIndexAction) RestSnapshotsStatusAction(org.elasticsearch.rest.action.admin.cluster.RestSnapshotsStatusAction) RestDeleteRepositoryAction(org.elasticsearch.rest.action.admin.cluster.RestDeleteRepositoryAction) List(java.util.List) TransportShardMultiGetAction(org.elasticsearch.action.get.TransportShardMultiGetAction) ClearScrollAction(org.elasticsearch.action.search.ClearScrollAction) TransportClusterStatsAction(org.elasticsearch.action.admin.cluster.stats.TransportClusterStatsAction) VerifyRepositoryAction(org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryAction) RestGetIndicesAction(org.elasticsearch.rest.action.admin.indices.RestGetIndicesAction) ClusterStateAction(org.elasticsearch.action.admin.cluster.state.ClusterStateAction) RestIndexAction(org.elasticsearch.rest.action.document.RestIndexAction) TransportClusterHealthAction(org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction) RestoreSnapshotAction(org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotAction) PendingClusterTasksAction(org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksAction) TransportIndicesExistsAction(org.elasticsearch.action.admin.indices.exists.indices.TransportIndicesExistsAction) SnapshotsStatusAction(org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusAction) RestFlushAction(org.elasticsearch.rest.action.admin.indices.RestFlushAction) RestCreateIndexAction(org.elasticsearch.rest.action.admin.indices.RestCreateIndexAction) TransportClusterRerouteAction(org.elasticsearch.action.admin.cluster.reroute.TransportClusterRerouteAction) TransportClusterStateAction(org.elasticsearch.action.admin.cluster.state.TransportClusterStateAction) TransportDeleteIndexTemplateAction(org.elasticsearch.action.admin.indices.template.delete.TransportDeleteIndexTemplateAction) RestListTasksAction(org.elasticsearch.rest.action.admin.cluster.RestListTasksAction) RestHandler(org.elasticsearch.rest.RestHandler) MapBinder(org.elasticsearch.common.inject.multibindings.MapBinder) RestNodeAttrsAction(org.elasticsearch.rest.action.cat.RestNodeAttrsAction) RestGetRepositoriesAction(org.elasticsearch.rest.action.admin.cluster.RestGetRepositoriesAction) SearchAction(org.elasticsearch.action.search.SearchAction) ClusterHealthAction(org.elasticsearch.action.admin.cluster.health.ClusterHealthAction) TransportPutMappingAction(org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction) SettingsFilter(org.elasticsearch.common.settings.SettingsFilter) ActionPlugin(org.elasticsearch.plugins.ActionPlugin) TransportPutRepositoryAction(org.elasticsearch.action.admin.cluster.repositories.put.TransportPutRepositoryAction) SearchScrollAction(org.elasticsearch.action.search.SearchScrollAction) TransportClusterUpdateSettingsAction(org.elasticsearch.action.admin.cluster.settings.TransportClusterUpdateSettingsAction) DeleteAction(org.elasticsearch.action.delete.DeleteAction) TransportGetFieldMappingsAction(org.elasticsearch.action.admin.indices.mapping.get.TransportGetFieldMappingsAction) AliasesExistAction(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistAction) ActionHandler(org.elasticsearch.plugins.ActionPlugin.ActionHandler) DeletePipelineAction(org.elasticsearch.action.ingest.DeletePipelineAction) TransportAliasesExistAction(org.elasticsearch.action.admin.indices.alias.exists.TransportAliasesExistAction) Collections.unmodifiableMap(java.util.Collections.unmodifiableMap) TransportGetSnapshotsAction(org.elasticsearch.action.admin.cluster.snapshots.get.TransportGetSnapshotsAction) AbstractCatAction(org.elasticsearch.rest.action.cat.AbstractCatAction) RestIndicesAliasesAction(org.elasticsearch.rest.action.admin.indices.RestIndicesAliasesAction) RestGetMappingAction(org.elasticsearch.rest.action.admin.indices.RestGetMappingAction) ArrayList(java.util.ArrayList) RestExplainAction(org.elasticsearch.rest.action.search.RestExplainAction) ActionPlugin(org.elasticsearch.plugins.ActionPlugin) RestDeletePipelineAction(org.elasticsearch.rest.action.ingest.RestDeletePipelineAction) RestTasksAction(org.elasticsearch.rest.action.cat.RestTasksAction) RestGetPipelineAction(org.elasticsearch.rest.action.ingest.RestGetPipelineAction) RestGetStoredScriptAction(org.elasticsearch.rest.action.admin.cluster.RestGetStoredScriptAction) RestUpdateAction(org.elasticsearch.rest.action.document.RestUpdateAction) RestVerifyRepositoryAction(org.elasticsearch.rest.action.admin.cluster.RestVerifyRepositoryAction) RestMultiSearchAction(org.elasticsearch.rest.action.search.RestMultiSearchAction) RestMasterAction(org.elasticsearch.rest.action.cat.RestMasterAction) RestClearIndicesCacheAction(org.elasticsearch.rest.action.admin.indices.RestClearIndicesCacheAction) RestAllocationAction(org.elasticsearch.rest.action.cat.RestAllocationAction) RestCatAction(org.elasticsearch.rest.action.cat.RestCatAction) RestIndexPutAliasAction(org.elasticsearch.rest.action.admin.indices.RestIndexPutAliasAction) RestPutIndexTemplateAction(org.elasticsearch.rest.action.admin.indices.RestPutIndexTemplateAction) RestClearScrollAction(org.elasticsearch.rest.action.search.RestClearScrollAction) RestHandler(org.elasticsearch.rest.RestHandler) RestRestoreSnapshotAction(org.elasticsearch.rest.action.admin.cluster.RestRestoreSnapshotAction) RestPutPipelineAction(org.elasticsearch.rest.action.ingest.RestPutPipelineAction) RestPutMappingAction(org.elasticsearch.rest.action.admin.indices.RestPutMappingAction) RestRolloverIndexAction(org.elasticsearch.rest.action.admin.indices.RestRolloverIndexAction) RestSearchScrollAction(org.elasticsearch.rest.action.search.RestSearchScrollAction) RestPendingClusterTasksAction(org.elasticsearch.rest.action.admin.cluster.RestPendingClusterTasksAction) RestPutRepositoryAction(org.elasticsearch.rest.action.admin.cluster.RestPutRepositoryAction) RestDeleteIndexTemplateAction(org.elasticsearch.rest.action.admin.indices.RestDeleteIndexTemplateAction) RestDeleteRepositoryAction(org.elasticsearch.rest.action.admin.cluster.RestDeleteRepositoryAction) RestOpenIndexAction(org.elasticsearch.rest.action.admin.indices.RestOpenIndexAction) RestSimulatePipelineAction(org.elasticsearch.rest.action.ingest.RestSimulatePipelineAction) RestGetAction(org.elasticsearch.rest.action.document.RestGetAction) RestIndicesAction(org.elasticsearch.rest.action.cat.RestIndicesAction) RestCancelTasksAction(org.elasticsearch.rest.action.admin.cluster.RestCancelTasksAction) RestAnalyzeAction(org.elasticsearch.rest.action.admin.indices.RestAnalyzeAction) RestSyncedFlushAction(org.elasticsearch.rest.action.admin.indices.RestSyncedFlushAction) RestCreateSnapshotAction(org.elasticsearch.rest.action.admin.cluster.RestCreateSnapshotAction) RestGetTaskAction(org.elasticsearch.rest.action.admin.cluster.RestGetTaskAction) RestFieldStatsAction(org.elasticsearch.rest.action.RestFieldStatsAction) RestMainAction(org.elasticsearch.rest.action.RestMainAction) RestDeleteSnapshotAction(org.elasticsearch.rest.action.admin.cluster.RestDeleteSnapshotAction) RestClusterHealthAction(org.elasticsearch.rest.action.admin.cluster.RestClusterHealthAction) RestRefreshAction(org.elasticsearch.rest.action.admin.indices.RestRefreshAction) RestClusterGetSettingsAction(org.elasticsearch.rest.action.admin.cluster.RestClusterGetSettingsAction) RestSnapshotsStatusAction(org.elasticsearch.rest.action.admin.cluster.RestSnapshotsStatusAction) RestNodesInfoAction(org.elasticsearch.rest.action.admin.cluster.RestNodesInfoAction) RestGetIndexTemplateAction(org.elasticsearch.rest.action.admin.indices.RestGetIndexTemplateAction) RestAliasAction(org.elasticsearch.rest.action.cat.RestAliasAction) RestClusterRerouteAction(org.elasticsearch.rest.action.admin.cluster.RestClusterRerouteAction) RestTemplatesAction(org.elasticsearch.rest.action.cat.RestTemplatesAction) RestSearchAction(org.elasticsearch.rest.action.search.RestSearchAction) RestNodesAction(org.elasticsearch.rest.action.cat.RestNodesAction) RestGetIndicesAction(org.elasticsearch.rest.action.admin.indices.RestGetIndicesAction) RestThreadPoolAction(org.elasticsearch.rest.action.cat.RestThreadPoolAction) RestHealthAction(org.elasticsearch.rest.action.cat.RestHealthAction) RestFielddataAction(org.elasticsearch.rest.action.cat.RestFielddataAction) RestUpgradeAction(org.elasticsearch.rest.action.admin.indices.RestUpgradeAction) RestSegmentsAction(org.elasticsearch.rest.action.cat.RestSegmentsAction) RestClusterUpdateSettingsAction(org.elasticsearch.rest.action.admin.cluster.RestClusterUpdateSettingsAction) RestGetSnapshotsAction(org.elasticsearch.rest.action.admin.cluster.RestGetSnapshotsAction) RestGetFieldMappingAction(org.elasticsearch.rest.action.admin.indices.RestGetFieldMappingAction) RestGetSourceAction(org.elasticsearch.rest.action.document.RestGetSourceAction) RestNodesHotThreadsAction(org.elasticsearch.rest.action.admin.cluster.RestNodesHotThreadsAction) RestDeleteStoredScriptAction(org.elasticsearch.rest.action.admin.cluster.RestDeleteStoredScriptAction) RestClusterStateAction(org.elasticsearch.rest.action.admin.cluster.RestClusterStateAction) RestShrinkIndexAction(org.elasticsearch.rest.action.admin.indices.RestShrinkIndexAction) RestClusterSearchShardsAction(org.elasticsearch.rest.action.admin.cluster.RestClusterSearchShardsAction) RestPluginsAction(org.elasticsearch.rest.action.cat.RestPluginsAction) RestGetAliasesAction(org.elasticsearch.rest.action.admin.indices.RestGetAliasesAction) RestMultiGetAction(org.elasticsearch.rest.action.document.RestMultiGetAction) RestClusterStatsAction(org.elasticsearch.rest.action.admin.cluster.RestClusterStatsAction) RestTypesExistsAction(org.elasticsearch.rest.action.admin.indices.RestTypesExistsAction) RestCreateIndexAction(org.elasticsearch.rest.action.admin.indices.RestCreateIndexAction) RestSnapshotAction(org.elasticsearch.rest.action.cat.RestSnapshotAction) RestRepositoriesAction(org.elasticsearch.rest.action.cat.RestRepositoriesAction) RestIndicesSegmentsAction(org.elasticsearch.rest.action.admin.indices.RestIndicesSegmentsAction) RestMultiTermVectorsAction(org.elasticsearch.rest.action.document.RestMultiTermVectorsAction) RestClusterAllocationExplainAction(org.elasticsearch.rest.action.admin.cluster.RestClusterAllocationExplainAction) RestIndexDeleteAliasesAction(org.elasticsearch.rest.action.admin.indices.RestIndexDeleteAliasesAction) RestBulkAction(org.elasticsearch.rest.action.document.RestBulkAction) RestIndicesShardStoresAction(org.elasticsearch.rest.action.admin.indices.RestIndicesShardStoresAction) RestCloseIndexAction(org.elasticsearch.rest.action.admin.indices.RestCloseIndexAction) RestGetRepositoriesAction(org.elasticsearch.rest.action.admin.cluster.RestGetRepositoriesAction) RestListTasksAction(org.elasticsearch.rest.action.admin.cluster.RestListTasksAction) RestValidateQueryAction(org.elasticsearch.rest.action.admin.indices.RestValidateQueryAction) RestIndicesStatsAction(org.elasticsearch.rest.action.admin.indices.RestIndicesStatsAction) RestForceMergeAction(org.elasticsearch.rest.action.admin.indices.RestForceMergeAction) RestUpdateSettingsAction(org.elasticsearch.rest.action.admin.indices.RestUpdateSettingsAction) RestPutStoredScriptAction(org.elasticsearch.rest.action.admin.cluster.RestPutStoredScriptAction) RestDeleteIndexAction(org.elasticsearch.rest.action.admin.indices.RestDeleteIndexAction) RestIndexAction(org.elasticsearch.rest.action.document.RestIndexAction) RestRecoveryAction(org.elasticsearch.rest.action.admin.indices.RestRecoveryAction) RestShardsAction(org.elasticsearch.rest.action.cat.RestShardsAction) RestNodesStatsAction(org.elasticsearch.rest.action.admin.cluster.RestNodesStatsAction) RestFlushAction(org.elasticsearch.rest.action.admin.indices.RestFlushAction) RestTermVectorsAction(org.elasticsearch.rest.action.document.RestTermVectorsAction) RestNodeAttrsAction(org.elasticsearch.rest.action.cat.RestNodeAttrsAction) RestGetSettingsAction(org.elasticsearch.rest.action.admin.indices.RestGetSettingsAction) RestDeleteAction(org.elasticsearch.rest.action.document.RestDeleteAction)

Example 3 with RestController

use of org.elasticsearch.rest.RestController in project elasticsearch by elastic.

the class ActionModuleTests method testPluginCantOverwriteBuiltinRestHandler.

public void testPluginCantOverwriteBuiltinRestHandler() throws IOException {
    ActionPlugin dupsMainAction = new ActionPlugin() {

        @Override
        public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
            return singletonList(new RestMainAction(settings, restController));
        }
    };
    SettingsModule settings = new SettingsModule(Settings.EMPTY);
    ThreadPool threadPool = new TestThreadPool(getTestName());
    try {
        ActionModule actionModule = new ActionModule(false, settings.getSettings(), new IndexNameExpressionResolver(Settings.EMPTY), settings.getIndexScopedSettings(), settings.getClusterSettings(), settings.getSettingsFilter(), threadPool, singletonList(dupsMainAction), null, null);
        Exception e = expectThrows(IllegalArgumentException.class, () -> actionModule.initRestHandlers(null));
        assertThat(e.getMessage(), startsWith("Path [/] already has a value [" + RestMainAction.class.getName()));
    } finally {
        threadPool.shutdown();
    }
}
Also used : ClusterSettings(org.elasticsearch.common.settings.ClusterSettings) IndexScopedSettings(org.elasticsearch.common.settings.IndexScopedSettings) ActionPlugin(org.elasticsearch.plugins.ActionPlugin) ThreadPool(org.elasticsearch.threadpool.ThreadPool) TestThreadPool(org.elasticsearch.threadpool.TestThreadPool) RestController(org.elasticsearch.rest.RestController) TestThreadPool(org.elasticsearch.threadpool.TestThreadPool) IOException(java.io.IOException) SettingsFilter(org.elasticsearch.common.settings.SettingsFilter) RestMainAction(org.elasticsearch.rest.action.RestMainAction) RestHandler(org.elasticsearch.rest.RestHandler) SettingsModule(org.elasticsearch.common.settings.SettingsModule) Supplier(java.util.function.Supplier) IndexNameExpressionResolver(org.elasticsearch.cluster.metadata.IndexNameExpressionResolver) Settings(org.elasticsearch.common.settings.Settings) IndexScopedSettings(org.elasticsearch.common.settings.IndexScopedSettings) ClusterSettings(org.elasticsearch.common.settings.ClusterSettings)

Example 4 with RestController

use of org.elasticsearch.rest.RestController in project elasticsearch by elastic.

the class ActionModuleTests method testPluginCanRegisterRestHandler.

public void testPluginCanRegisterRestHandler() {
    class FakeHandler implements RestHandler {

        FakeHandler(RestController restController) {
            restController.registerHandler(Method.GET, "/_dummy", this);
        }

        @Override
        public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
        }
    }
    ActionPlugin registersFakeHandler = new ActionPlugin() {

        @Override
        public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
            return singletonList(new FakeHandler(restController));
        }
    };
    SettingsModule settings = new SettingsModule(Settings.EMPTY);
    ThreadPool threadPool = new TestThreadPool(getTestName());
    try {
        ActionModule actionModule = new ActionModule(false, settings.getSettings(), new IndexNameExpressionResolver(Settings.EMPTY), settings.getIndexScopedSettings(), settings.getClusterSettings(), settings.getSettingsFilter(), threadPool, singletonList(registersFakeHandler), null, null);
        actionModule.initRestHandlers(null);
        // At this point the easiest way to confirm that a handler is loaded is to try to register another one on top of it and to fail
        Exception e = expectThrows(IllegalArgumentException.class, () -> actionModule.getRestController().registerHandler(Method.GET, "/_dummy", null));
        assertThat(e.getMessage(), startsWith("Path [/_dummy] already has a value [" + FakeHandler.class.getName()));
    } finally {
        threadPool.shutdown();
    }
}
Also used : NodeClient(org.elasticsearch.client.node.NodeClient) ClusterSettings(org.elasticsearch.common.settings.ClusterSettings) IndexScopedSettings(org.elasticsearch.common.settings.IndexScopedSettings) ActionPlugin(org.elasticsearch.plugins.ActionPlugin) ThreadPool(org.elasticsearch.threadpool.ThreadPool) TestThreadPool(org.elasticsearch.threadpool.TestThreadPool) RestController(org.elasticsearch.rest.RestController) RestChannel(org.elasticsearch.rest.RestChannel) TestThreadPool(org.elasticsearch.threadpool.TestThreadPool) IOException(java.io.IOException) SettingsFilter(org.elasticsearch.common.settings.SettingsFilter) RestRequest(org.elasticsearch.rest.RestRequest) RestHandler(org.elasticsearch.rest.RestHandler) SettingsModule(org.elasticsearch.common.settings.SettingsModule) Supplier(java.util.function.Supplier) IndexNameExpressionResolver(org.elasticsearch.cluster.metadata.IndexNameExpressionResolver) Settings(org.elasticsearch.common.settings.Settings) IndexScopedSettings(org.elasticsearch.common.settings.IndexScopedSettings) ClusterSettings(org.elasticsearch.common.settings.ClusterSettings)

Example 5 with RestController

use of org.elasticsearch.rest.RestController in project elasticsearch by elastic.

the class RestIndicesActionTests method testBuildTable.

public void testBuildTable() {
    final Settings settings = Settings.EMPTY;
    final RestController restController = new RestController(settings, Collections.emptySet(), null, null, null);
    final RestIndicesAction action = new RestIndicesAction(settings, restController, new IndexNameExpressionResolver(settings));
    // build a (semi-)random table
    final int numIndices = randomIntBetween(0, 5);
    Index[] indices = new Index[numIndices];
    for (int i = 0; i < numIndices; i++) {
        indices[i] = new Index(randomAsciiOfLength(5), UUIDs.randomBase64UUID());
    }
    final MetaData.Builder metaDataBuilder = MetaData.builder();
    for (final Index index : indices) {
        metaDataBuilder.put(IndexMetaData.builder(index.getName()).settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).put(IndexMetaData.SETTING_INDEX_UUID, index.getUUID())).creationDate(System.currentTimeMillis()).numberOfShards(1).numberOfReplicas(1).state(IndexMetaData.State.OPEN));
    }
    final MetaData metaData = metaDataBuilder.build();
    final ClusterState clusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY)).metaData(metaData).build();
    final String[] indicesStr = new String[indices.length];
    for (int i = 0; i < indices.length; i++) {
        indicesStr[i] = indices[i].getName();
    }
    final ClusterHealthResponse clusterHealth = new ClusterHealthResponse(clusterState.getClusterName().value(), indicesStr, clusterState, 0, 0, 0, TimeValue.timeValueMillis(1000L));
    final Table table = action.buildTable(new FakeRestRequest(), indices, clusterHealth, randomIndicesStatsResponse(indices), metaData);
    // now, verify the table is correct
    int count = 0;
    List<Table.Cell> headers = table.getHeaders();
    assertThat(headers.get(count++).value, equalTo("health"));
    assertThat(headers.get(count++).value, equalTo("status"));
    assertThat(headers.get(count++).value, equalTo("index"));
    assertThat(headers.get(count++).value, equalTo("uuid"));
    List<List<Table.Cell>> rows = table.getRows();
    assertThat(rows.size(), equalTo(indices.length));
    // TODO: more to verify (e.g. randomize cluster health, num primaries, num replicas, etc)
    for (int i = 0; i < rows.size(); i++) {
        count = 0;
        final List<Table.Cell> row = rows.get(i);
        // all are red because cluster state doesn't have routing entries
        assertThat(row.get(count++).value, equalTo("red*"));
        // all are OPEN for now
        assertThat(row.get(count++).value, equalTo("open"));
        assertThat(row.get(count++).value, equalTo(indices[i].getName()));
        assertThat(row.get(count++).value, equalTo(indices[i].getUUID()));
    }
}
Also used : ClusterState(org.elasticsearch.cluster.ClusterState) Table(org.elasticsearch.common.Table) ClusterHealthResponse(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse) RestController(org.elasticsearch.rest.RestController) Index(org.elasticsearch.index.Index) FakeRestRequest(org.elasticsearch.test.rest.FakeRestRequest) MetaData(org.elasticsearch.cluster.metadata.MetaData) IndexMetaData(org.elasticsearch.cluster.metadata.IndexMetaData) ArrayList(java.util.ArrayList) Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) IndexNameExpressionResolver(org.elasticsearch.cluster.metadata.IndexNameExpressionResolver) Settings(org.elasticsearch.common.settings.Settings)

Aggregations

Settings (org.elasticsearch.common.settings.Settings)5 RestController (org.elasticsearch.rest.RestController)5 IndexNameExpressionResolver (org.elasticsearch.cluster.metadata.IndexNameExpressionResolver)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Supplier (java.util.function.Supplier)3 ClusterSettings (org.elasticsearch.common.settings.ClusterSettings)3 IndexScopedSettings (org.elasticsearch.common.settings.IndexScopedSettings)3 SettingsFilter (org.elasticsearch.common.settings.SettingsFilter)3 ActionPlugin (org.elasticsearch.plugins.ActionPlugin)3 RestHandler (org.elasticsearch.rest.RestHandler)3 ThreadPool (org.elasticsearch.threadpool.ThreadPool)3 IOException (java.io.IOException)2 NodeClient (org.elasticsearch.client.node.NodeClient)2 SettingsModule (org.elasticsearch.common.settings.SettingsModule)2 RestMainAction (org.elasticsearch.rest.action.RestMainAction)2 TestThreadPool (org.elasticsearch.threadpool.TestThreadPool)2 Collections.emptyList (java.util.Collections.emptyList)1 Collections.unmodifiableList (java.util.Collections.unmodifiableList)1 Collections.unmodifiableMap (java.util.Collections.unmodifiableMap)1