org.elasticsearch.action.support.ActionFilters Java Examples

The following examples show how to use org.elasticsearch.action.support.ActionFilters. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransportCancelTasksAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportCancelTasksAction(Settings settings, ClusterName clusterName, ThreadPool threadPool, ClusterService clusterService,
                                  TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver
                                      indexNameExpressionResolver) {
    super(settings, CancelTasksAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
        indexNameExpressionResolver, new Callable<CancelTasksRequest>() {
            @Override
            public CancelTasksRequest call() throws Exception {
                return new CancelTasksRequest();
            }
        }, ThreadPool.Names.MANAGEMENT);
    transportService.registerRequestHandler(BAN_PARENT_ACTION_NAME, new Callable<BanParentTaskRequest>() {
        @Override
        public BanParentTaskRequest call() throws Exception {
            return new BanParentTaskRequest();
        }
    }, ThreadPool.Names.SAME, new
        BanParentRequestHandler());
}
 
Example #2
Source File: TransportSQLAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportSQLAction(
        ClusterService clusterService,
        Settings settings,
        ThreadPool threadPool,
        Analyzer analyzer,
        Planner planner,
        Provider<Executor> executor,
        TransportService transportService,
        StatsTables statsTables,
        ActionFilters actionFilters,
        IndexNameExpressionResolver indexNameExpressionResolver,
        TransportKillJobsNodeAction transportKillJobsNodeAction) {
    super(clusterService, settings, SQLAction.NAME, threadPool,
        analyzer, planner, executor, statsTables, actionFilters,
        indexNameExpressionResolver, transportKillJobsNodeAction,
        transportService.getTaskManager());
    transportService.registerRequestHandler(SQLAction.NAME, SQLRequest.class, ThreadPool.Names.SAME, new TransportHandler());
}
 
Example #3
Source File: DeleteModelTransportAction.java    From anomaly-detection with Apache License 2.0 6 votes vote down vote up
@Inject
public DeleteModelTransportAction(
    ThreadPool threadPool,
    ClusterService clusterService,
    TransportService transportService,
    ActionFilters actionFilters,
    ADStateManager tarnsportStatemanager,
    ModelManager modelManager,
    FeatureManager featureManager
) {
    super(
        DeleteModelAction.NAME,
        threadPool,
        clusterService,
        transportService,
        actionFilters,
        DeleteModelRequest::new,
        DeleteModelNodeRequest::new,
        ThreadPool.Names.MANAGEMENT,
        DeleteModelNodeResponse.class
    );
    this.transportStateManager = tarnsportStatemanager;
    this.modelManager = modelManager;
    this.featureManager = featureManager;
}
 
Example #4
Source File: TransportBroadcastByNodeAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public TransportBroadcastByNodeAction(
        Settings settings,
        String actionName,
        ThreadPool threadPool,
        ClusterService clusterService,
        TransportService transportService,
        ActionFilters actionFilters,
        IndexNameExpressionResolver indexNameExpressionResolver,
        Class<Request> request,
        String executor) {
    super(settings, actionName, threadPool, transportService, actionFilters, indexNameExpressionResolver, request);

    this.clusterService = clusterService;
    this.transportService = transportService;

    transportNodeBroadcastAction = actionName + "[n]";

    transportService.registerRequestHandler(transportNodeBroadcastAction, new Callable<NodeRequest>() {
        @Override
        public NodeRequest call() throws Exception {
            return new NodeRequest();
        }
    }, executor, new BroadcastByNodeTransportRequestHandler());
}
 
Example #5
Source File: TransportReplicationAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
protected TransportReplicationAction(Settings settings, String actionName, TransportService transportService,
                                     ClusterService clusterService, IndicesService indicesService,
                                     ThreadPool threadPool, ShardStateAction shardStateAction,
                                     MappingUpdatedAction mappingUpdatedAction, ActionFilters actionFilters,
                                     IndexNameExpressionResolver indexNameExpressionResolver, Class<Request> request,
                                     Class<ReplicaRequest> replicaRequest, String executor) {
    super(settings, actionName, threadPool, actionFilters, indexNameExpressionResolver, transportService.getTaskManager());
    this.transportService = transportService;
    this.clusterService = clusterService;
    this.indicesService = indicesService;
    this.shardStateAction = shardStateAction;
    this.mappingUpdatedAction = mappingUpdatedAction;

    this.transportPrimaryAction = actionName + "[p]";
    this.transportReplicaAction = actionName + "[r]";
    this.executor = executor;
    this.checkWriteConsistency = checkWriteConsistency();
    transportService.registerRequestHandler(actionName, request, ThreadPool.Names.SAME, new OperationTransportHandler());
    transportService.registerRequestHandler(transportPrimaryAction, request, executor, new PrimaryOperationTransportHandler());
    // we must never reject on because of thread pool capacity on replicas
    transportService.registerRequestHandler(transportReplicaAction, replicaRequest, executor, true, new ReplicaOperationTransportHandler());

    this.transportOptions = transportOptions();

    this.defaultWriteConsistencyLevel = WriteConsistencyLevel.fromString(settings.get("action.write_consistency", "quorum"));
}
 
Example #6
Source File: ADStatsNodesTransportAction.java    From anomaly-detection with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param threadPool ThreadPool to use
 * @param clusterService ClusterService
 * @param transportService TransportService
 * @param actionFilters Action Filters
 * @param adStats ADStats object
 */
@Inject
public ADStatsNodesTransportAction(
    ThreadPool threadPool,
    ClusterService clusterService,
    TransportService transportService,
    ActionFilters actionFilters,
    ADStats adStats
) {
    super(
        ADStatsNodesAction.NAME,
        threadPool,
        clusterService,
        transportService,
        actionFilters,
        ADStatsRequest::new,
        ADStatsNodeRequest::new,
        ThreadPool.Names.MANAGEMENT,
        ADStatsNodeResponse.class
    );
    this.adStats = adStats;
}
 
Example #7
Source File: AnomalyResultTests.java    From anomaly-detection with Apache License 2.0 6 votes vote down vote up
public void testColdStartIllegalArgumentException() throws Exception {
    when(featureQuery.getColdStartData(any(AnomalyDetector.class))).thenReturn(Optional.of(new double[][] { { 1.0 } }));
    doThrow(new IllegalArgumentException("")).when(normalModelManager).trainModel(any(AnomalyDetector.class), any(double[][].class));

    AnomalyResultTransportAction action = new AnomalyResultTransportAction(
        new ActionFilters(Collections.emptySet()),
        transportService,
        settings,
        stateManager,
        runner,
        featureQuery,
        normalModelManager,
        hashRing,
        clusterService,
        indexNameResolver,
        adCircuitBreakerService,
        adStats
    );

    AnomalyResultTransportAction.ColdStartJob job = action.new ColdStartJob(detector);
    expectThrows(EndRunException.class, () -> job.call());
}
 
Example #8
Source File: ThresholdResultTests.java    From anomaly-detection with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void testExecutionException() {
    TransportService transportService = new TransportService(
        Settings.EMPTY,
        mock(Transport.class),
        null,
        TransportService.NOOP_TRANSPORT_INTERCEPTOR,
        x -> null,
        null,
        Collections.emptySet()
    );

    ModelManager manager = mock(ModelManager.class);
    ThresholdResultTransportAction action = new ThresholdResultTransportAction(mock(ActionFilters.class), transportService, manager);
    doThrow(NullPointerException.class)
        .when(manager)
        .getThresholdingResult(any(String.class), any(String.class), anyDouble(), any(ActionListener.class));

    final PlainActionFuture<ThresholdResultResponse> future = new PlainActionFuture<>();
    ThresholdResultRequest request = new ThresholdResultRequest("123", "123-threshold", 2);
    action.doExecute(mock(Task.class), request, future);

    expectThrows(NullPointerException.class, () -> future.actionGet());
}
 
Example #9
Source File: AnomalyResultTests.java    From anomaly-detection with Apache License 2.0 6 votes vote down vote up
public void testNullRCFResult() {
    AnomalyResultTransportAction action = new AnomalyResultTransportAction(
        new ActionFilters(Collections.emptySet()),
        transportService,
        settings,
        stateManager,
        runner,
        featureQuery,
        normalModelManager,
        hashRing,
        clusterService,
        indexNameResolver,
        adCircuitBreakerService,
        adStats
    );
    AnomalyResultTransportAction.RCFActionListener listener = action.new RCFActionListener(
        null, "123-rcf-0", null, "123", null, null, null, null, null, 0, new AtomicInteger(), null
    );
    listener.onResponse(null);
    assertTrue(testAppender.containsMessage(AnomalyResultTransportAction.NULL_RESPONSE));
}
 
Example #10
Source File: TransportFieldStatsTransportAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportFieldStatsTransportAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                                          TransportService transportService, ActionFilters actionFilters,
                                          IndexNameExpressionResolver indexNameExpressionResolver, IndicesService indicesService) {
    super(settings, FieldStatsAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, FieldStatsRequest.class, FieldStatsShardRequest.class, ThreadPool.Names.MANAGEMENT);
    this.indicesService = indicesService;
}
 
Example #11
Source File: TransportGetSettingsAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportGetSettingsAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                  ThreadPool threadPool, SettingsFilter settingsFilter, ActionFilters actionFilters,
                                  IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, GetSettingsAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, GetSettingsRequest.class);
    this.settingsFilter = settingsFilter;
}
 
Example #12
Source File: TransportShardMultiGetAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportShardMultiGetAction(Settings settings, ClusterService clusterService, TransportService transportService,
                                    IndicesService indicesService, ThreadPool threadPool, ActionFilters actionFilters,
                                    IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ACTION_NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            MultiGetShardRequest.class, ThreadPool.Names.GET);
    this.indicesService = indicesService;

    this.realtime = settings.getAsBoolean("action.get.realtime", true);
}
 
Example #13
Source File: TransportRefreshAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportRefreshAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                              TransportService transportService, ActionFilters actionFilters,
                              IndexNameExpressionResolver indexNameExpressionResolver,
                              TransportShardRefreshAction shardRefreshAction) {
    super(RefreshAction.NAME, RefreshRequest.class, settings, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, shardRefreshAction);
}
 
Example #14
Source File: TransportPutMappingAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportPutMappingAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                 ThreadPool threadPool, MetaDataMappingService metaDataMappingService,
                                 ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, PutMappingAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, PutMappingRequest.class);
    this.metaDataMappingService = metaDataMappingService;
}
 
Example #15
Source File: TransportPutRepositoryAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportPutRepositoryAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                    RepositoriesService repositoriesService, ThreadPool threadPool, ActionFilters actionFilters,
                                    IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, PutRepositoryAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, PutRepositoryRequest.class);
    this.repositoriesService = repositoriesService;
}
 
Example #16
Source File: TransportUpgradeAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportUpgradeAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                              TransportService transportService, IndicesService indicesService, ActionFilters actionFilters,
                              IndexNameExpressionResolver indexNameExpressionResolver, TransportUpgradeSettingsAction upgradeSettingsAction) {
    super(settings, UpgradeAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, UpgradeRequest.class, ThreadPool.Names.FORCE_MERGE);
    this.indicesService = indicesService;
    this.upgradeSettingsAction = upgradeSettingsAction;
}
 
Example #17
Source File: TransportDeleteIndexAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDeleteIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                  ThreadPool threadPool, MetaDataDeleteIndexService deleteIndexService,
                                  NodeSettingsService nodeSettingsService, ActionFilters actionFilters,
                                  IndexNameExpressionResolver indexNameExpressionResolver, DestructiveOperations destructiveOperations) {
    super(settings, DeleteIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, DeleteIndexRequest.class);
    this.deleteIndexService = deleteIndexService;
    this.destructiveOperations = destructiveOperations;
}
 
Example #18
Source File: TransportAnalyzeAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportAnalyzeAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService,
                              IndicesService indicesService, IndicesAnalysisService indicesAnalysisService, ActionFilters actionFilters,
                              IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, AnalyzeAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, AnalyzeRequest.class, ThreadPool.Names.INDEX);
    this.indicesService = indicesService;
    this.indicesAnalysisService = indicesAnalysisService;
}
 
Example #19
Source File: TransportClearScrollAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportClearScrollAction(Settings settings, TransportService transportService, ThreadPool threadPool,
                                  ClusterService clusterService, SearchServiceTransportAction searchServiceTransportAction,
                                  ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ClearScrollAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, ClearScrollRequest.class);
    this.clusterService = clusterService;
    this.searchServiceTransportAction = searchServiceTransportAction;
}
 
Example #20
Source File: TransportShardDeleteAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportShardDeleteAction(Settings settings,
                                  TransportService transportService,
                                  MappingUpdatedAction mappingUpdatedAction,
                                  IndexNameExpressionResolver indexNameExpressionResolver,
                                  ClusterService clusterService,
                                  IndicesService indicesService,
                                  ThreadPool threadPool,
                                  ShardStateAction shardStateAction,
                                  ActionFilters actionFilters) {
    super(settings, ACTION_NAME, transportService, mappingUpdatedAction, indexNameExpressionResolver,
            clusterService, indicesService, threadPool, shardStateAction, actionFilters, ShardDeleteRequest.class);
}
 
Example #21
Source File: TransportListTasksAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportListTasksAction(Settings settings, ClusterName clusterName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ListTasksAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
        indexNameExpressionResolver, new Callable<ListTasksRequest>() {
            @Override
            public ListTasksRequest call() throws Exception {
                return new ListTasksRequest();
            }
        }, ThreadPool.Names.MANAGEMENT);
}
 
Example #22
Source File: TransportNodesStatsAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportNodesStatsAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
                                 ClusterService clusterService, TransportService transportService,
                                 NodeService nodeService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, NodesStatsAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            NodesStatsRequest.class, NodeStatsRequest.class, ThreadPool.Names.MANAGEMENT);
    this.nodeService = nodeService;
}
 
Example #23
Source File: TransportNodesListGatewayStartedShards.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportNodesListGatewayStartedShards(Settings settings, ClusterName clusterName, ThreadPool threadPool,
                                              ClusterService clusterService, TransportService transportService,
                                              ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, NodeEnvironment env) {
    super(settings, ACTION_NAME, clusterName, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            Request.class, NodeRequest.class, ThreadPool.Names.FETCH_SHARD_STARTED);
    this.nodeEnv = env;
}
 
Example #24
Source File: TransportMultiTermVectorsAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportMultiTermVectorsAction(Settings settings, ThreadPool threadPool, TransportService transportService,
                                       ClusterService clusterService, TransportShardMultiTermsVectorAction shardAction,
                                       ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, MultiTermVectorsAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, MultiTermVectorsRequest.class);
    this.clusterService = clusterService;
    this.shardAction = shardAction;
}
 
Example #25
Source File: TransportNodesInfoAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportNodesInfoAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
                                ClusterService clusterService, TransportService transportService,
                                NodeService nodeService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, NodesInfoAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
            indexNameExpressionResolver, NodesInfoRequest.class, NodeInfoRequest.class, ThreadPool.Names.MANAGEMENT);
    this.nodeService = nodeService;
}
 
Example #26
Source File: TransportDeleteNodeAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDeleteNodeAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                  ThreadPool threadPool, MetaDataDeleteIndexService deleteIndexService,
                                  NodeSettingsService nodeSettingsService, ActionFilters actionFilters,
                                  IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, DeleteNodeAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, DeleteNodeRequest.class);
}
 
Example #27
Source File: TransportClusterUpdateSettingsAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportClusterUpdateSettingsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
                                            AllocationService allocationService, @ClusterDynamicSettings DynamicSettings dynamicSettings,
                                            ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ClusterUpdateSettingsAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, ClusterUpdateSettingsRequest.class);
    this.allocationService = allocationService;
    this.dynamicSettings = dynamicSettings;
}
 
Example #28
Source File: TransportNodesHotThreadsAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportNodesHotThreadsAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
                                      ClusterService clusterService, TransportService transportService,
                                      ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, NodesHotThreadsAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
            indexNameExpressionResolver, NodesHotThreadsRequest.class, NodeRequest.class, ThreadPool.Names.GENERIC);
}
 
Example #29
Source File: TransportDeleteAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDeleteAction(Settings settings, TransportService transportService, ClusterService clusterService,
                             IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction,
                             TransportCreateIndexAction createIndexAction, ActionFilters actionFilters,
                             IndexNameExpressionResolver indexNameExpressionResolver, MappingUpdatedAction mappingUpdatedAction,
                             AutoCreateIndex autoCreateIndex) {
    super(settings, DeleteAction.NAME, transportService, clusterService, indicesService, threadPool, shardStateAction,
            mappingUpdatedAction, actionFilters, indexNameExpressionResolver,
            DeleteRequest.class, DeleteRequest.class, ThreadPool.Names.INDEX);
    this.createIndexAction = createIndexAction;
    this.autoCreateIndex = autoCreateIndex;
}
 
Example #30
Source File: TransportBroadcastAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
protected TransportBroadcastAction(Settings settings, String actionName, ThreadPool threadPool, ClusterService clusterService,
                                   TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
                                   Class<Request> request, Class<ShardRequest> shardRequest, String shardExecutor) {
    super(settings, actionName, threadPool, transportService, actionFilters, indexNameExpressionResolver, request);
    this.clusterService = clusterService;
    this.transportService = transportService;
    this.transportShardAction = actionName + "[s]";

    transportService.registerRequestHandler(transportShardAction, shardRequest, shardExecutor, new ShardTransportHandler());
}