org.elasticsearch.common.settings.SettingsFilter Java Examples

The following examples show how to use org.elasticsearch.common.settings.SettingsFilter. 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: ZentityPlugin.java    From zentity with Apache License 2.0 6 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(
        Settings settings,
        RestController restController,
        ClusterSettings clusterSettings,
        IndexScopedSettings indexScopedSettings,
        SettingsFilter settingsFilter,
        IndexNameExpressionResolver indexNameExpressionResolver,
        Supplier<DiscoveryNodes> nodesInCluster) {
    List<RestHandler> handlers = new ArrayList<RestHandler>() {{
        new HomeAction(restController);
        new ModelsAction(restController);
        new ResolutionAction(restController);
        new SetupAction(restController);
    }};
    return handlers;
}
 
Example #2
Source File: BundlePlugin.java    From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings,
                                         RestController restController,
                                         ClusterSettings clusterSettings,
                                         IndexScopedSettings indexScopedSettings,
                                         SettingsFilter settingsFilter,
                                         IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
    List<RestHandler> extra = new ArrayList<>();
    if (settings.getAsBoolean("plugins.xbib.isbnformat.enabled", true)) {
        extra.add(new RestISBNFormatterAction(settings, restController));
    }
    if (settings.getAsBoolean("plugins.xbib.langdetect.enabled", true)) {
        extra.add(new RestLangdetectAction(settings, restController));
    }
    return extra;
}
 
Example #3
Source File: TransportGetSettingsAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void masterOperation(GetSettingsRequest request, ClusterState state, ActionListener<GetSettingsResponse> listener) {
    String[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request);
    ImmutableOpenMap.Builder<String, Settings> indexToSettingsBuilder = ImmutableOpenMap.builder();
    for (String concreteIndex : concreteIndices) {
        IndexMetaData indexMetaData = state.getMetaData().index(concreteIndex);
        if (indexMetaData == null) {
            continue;
        }

        Settings settings = SettingsFilter.filterSettings(settingsFilter.getPatterns(), indexMetaData.getSettings());
        if (request.humanReadable()) {
            settings = IndexMetaData.addHumanReadableSettings(settings);
        }
        if (!CollectionUtils.isEmpty(request.names())) {
            Settings.Builder settingsBuilder = Settings.builder();
            for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) {
                if (Regex.simpleMatch(request.names(), entry.getKey())) {
                    settingsBuilder.put(entry.getKey(), entry.getValue());
                }
            }
            settings = settingsBuilder.build();
        }
        indexToSettingsBuilder.put(concreteIndex, settings);
    }
    listener.onResponse(new GetSettingsResponse(indexToSettingsBuilder.build()));
}
 
Example #4
Source File: ClusterStateRequestBuilder.java    From elasticshell with Apache License 2.0 5 votes vote down vote up
@Override
protected XContentBuilder toXContent(ClusterStateRequest request, ClusterStateResponse response, XContentBuilder builder) throws IOException {
    builder.startObject();
    builder.field(Fields.CLUSTER_NAME, response.getClusterName().value());
    response.getState().settingsFilter(new SettingsFilter(ImmutableSettings.settingsBuilder().build())).toXContent(builder, ToXContent.EMPTY_PARAMS);
    builder.endObject();
    return builder;
}
 
Example #5
Source File: NodesInfoRequestBuilder.java    From elasticshell with Apache License 2.0 5 votes vote down vote up
@Override
protected XContentBuilder toXContent(NodesInfoRequest request, NodesInfoResponse response, XContentBuilder builder) throws IOException {
    response.settingsFilter(new SettingsFilter(ImmutableSettings.settingsBuilder().build()));
    builder.startObject();
    builder.field(Fields.OK, true);
    response.toXContent(builder, ToXContent.EMPTY_PARAMS);
    builder.endObject();
    return builder;
}
 
Example #6
Source File: ClusterRerouteRequestBuilder.java    From elasticshell with Apache License 2.0 5 votes vote down vote up
@Override
protected XContentBuilder toXContent(ClusterRerouteRequest request, ClusterRerouteResponse response, XContentBuilder builder) throws IOException {
    builder.startObject();
    builder.field(Fields.OK, true);
    builder.startObject("state");
    response.getState().settingsFilter(new SettingsFilter(ImmutableSettings.settingsBuilder().build())).toXContent(builder, ToXContent.EMPTY_PARAMS);
    builder.endObject();

    builder.endObject();

    return builder;
}
 
Example #7
Source File: Exporter.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Inject
public Exporter(VersionFetchSubPhase versionPhase, Injector injector,
        SettingsFilter settingsFilter) {
    this.fetchSubPhases = new FetchSubPhase[]{versionPhase};
    this.injector = injector;
    this.settingsFilter = settingsFilter;
}
 
Example #8
Source File: ClusteringPlugin.java    From elasticsearch-carrot2 with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController,
                                         ClusterSettings clusterSettings,
                                         IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
                                         IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
   return Arrays.asList(
       new ClusteringAction.RestClusteringAction(restController),
       new ListAlgorithmsAction.RestListAlgorithmsAction(restController));
}
 
Example #9
Source File: DataFormatPlugin.java    From elasticsearch-dataformat with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(final Settings settings,
        final RestController restController, final ClusterSettings clusterSettings,
        final IndexScopedSettings indexScopedSettings,
        final SettingsFilter settingsFilter,
        final IndexNameExpressionResolver indexNameExpressionResolver,
        final Supplier<DiscoveryNodes> nodesInCluster) {
    return Arrays.asList(new RestDataAction(settings, restController));
}
 
Example #10
Source File: OpenShiftElasticSearchPlugin.java    From openshift-elasticsearch-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController,
        ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
        IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    List<RestHandler> list = new ArrayList<>();
    list.addAll(sgPlugin.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings,
            settingsFilter, indexNameExpressionResolver, nodesInCluster));
    return list;
}
 
Example #11
Source File: LtrQueryParserPlugin.java    From elasticsearch-learning-to-rank with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController,
                                         ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings,
                                         SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
    List<RestHandler> list = new ArrayList<>();
    RestSimpleFeatureStore.register(list, restController);
    list.add(new RestFeatureStoreCaches());
    list.add(new RestCreateModelFromSet());
    list.add(new RestAddFeatureToSet());
    return unmodifiableList(list);
}
 
Example #12
Source File: AppendLucenePlugin.java    From ES-Fastloader with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings,
                                         RestController restController,
                                         ClusterSettings clusterSettings,
                                         IndexScopedSettings indexScopedSettings,
                                         SettingsFilter settingsFilter,
                                         IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
    return Arrays.asList( new AppendLuceneRestHandler(settings, restController));
}
 
Example #13
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 #14
Source File: RestNodesInfoAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public RestNodesInfoAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
    super(settings, controller, client);
    controller.registerHandler(GET, "/_nodes", this);
    // this endpoint is used for metrics, not for nodeIds, like /_nodes/fs
    controller.registerHandler(GET, "/_nodes/{nodeId}", this);
    controller.registerHandler(GET, "/_nodes/{nodeId}/{metrics}", this);
    // added this endpoint to be aligned with stats
    controller.registerHandler(GET, "/_nodes/{nodeId}/info/{metrics}", this);

    this.settingsFilter = settingsFilter;
}
 
Example #15
Source File: RestClusterStateAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public RestClusterStateAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
    super(settings, controller, client);
    controller.registerHandler(RestRequest.Method.GET, "/_cluster/state", this);
    controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}", this);
    controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}/{indices}", this);

    this.settingsFilter = settingsFilter;
}
 
Example #16
Source File: RestGetRepositoriesAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public RestGetRepositoriesAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
    super(settings, controller, client);
    controller.registerHandler(GET, "/_snapshot", this);
    controller.registerHandler(GET, "/_snapshot/{repository}", this);
    this.settingsFilter = settingsFilter;
}
 
Example #17
Source File: ElasticReportPlugin.java    From elasticsearch-report-engine with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings,
    RestController restController, ClusterSettings clusterSettings,
    IndexScopedSettings indexScopedSettings,
    SettingsFilter settingsFilter,
    IndexNameExpressionResolver indexNameExpressionResolver,
    Supplier<DiscoveryNodes> nodesInCluster) {
  return Arrays.asList(new ReportGenerateRestAction(settings, restController));
}
 
Example #18
Source File: OpenDistroSecuritySSLPlugin.java    From deprecated-security-ssl with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
        IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
        IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    
    final List<RestHandler> handlers = new ArrayList<RestHandler>(1);
    
    if (!client) {
        handlers.add(new OpenDistroSecuritySSLInfoAction(settings, configPath, restController, odsks, Objects.requireNonNull(principalExtractor)));
    }
    
    return handlers;
}
 
Example #19
Source File: SqlPlug.java    From elasticsearch-sql with Apache License 2.0 4 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    return Collections.singletonList(new RestSqlAction());
}
 
Example #20
Source File: RestClusterRerouteAction.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public RestClusterRerouteAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
    super(settings, controller, client);
    this.settingsFilter = settingsFilter;
    controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this);
}
 
Example #21
Source File: SqlPlugin.java    From elasticsearch-sql with MIT License 4 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    return Collections.singletonList(new RestSqlAction());
}
 
Example #22
Source File: AnomalyDetectorPlugin.java    From anomaly-detection with Apache License 2.0 4 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(
    Settings settings,
    RestController restController,
    ClusterSettings clusterSettings,
    IndexScopedSettings indexScopedSettings,
    SettingsFilter settingsFilter,
    IndexNameExpressionResolver indexNameExpressionResolver,
    Supplier<DiscoveryNodes> nodesInCluster
) {
    AnomalyResultHandler anomalyResultHandler = new AnomalyResultHandler(
        client,
        settings,
        clusterService,
        indexNameExpressionResolver,
        anomalyDetectionIndices,
        threadPool
    );
    AnomalyDetectorJobRunner jobRunner = AnomalyDetectorJobRunner.getJobRunnerInstance();
    jobRunner.setClient(client);
    jobRunner.setClientUtil(clientUtil);
    jobRunner.setThreadPool(threadPool);
    jobRunner.setAnomalyResultHandler(anomalyResultHandler);
    jobRunner.setSettings(settings);

    AnomalyDetectorProfileRunner profileRunner = new AnomalyDetectorProfileRunner(
        client,
        this.xContentRegistry,
        this.nodeFilter,
        indexNameExpressionResolver,
        clusterService,
        Calendar.getInstance(TimeZone.getTimeZone("UTC"))
    );
    RestGetAnomalyDetectorAction restGetAnomalyDetectorAction = new RestGetAnomalyDetectorAction(profileRunner);
    RestIndexAnomalyDetectorAction restIndexAnomalyDetectorAction = new RestIndexAnomalyDetectorAction(
        settings,
        clusterService,
        anomalyDetectionIndices
    );
    RestSearchAnomalyDetectorAction searchAnomalyDetectorAction = new RestSearchAnomalyDetectorAction();
    RestSearchAnomalyResultAction searchAnomalyResultAction = new RestSearchAnomalyResultAction();
    RestDeleteAnomalyDetectorAction deleteAnomalyDetectorAction = new RestDeleteAnomalyDetectorAction(clusterService);
    RestExecuteAnomalyDetectorAction executeAnomalyDetectorAction = new RestExecuteAnomalyDetectorAction(
        settings,
        clusterService,
        anomalyDetectorRunner
    );
    RestStatsAnomalyDetectorAction statsAnomalyDetectorAction = new RestStatsAnomalyDetectorAction(
        adStats,
        this.nodeFilter,
        this.clusterService
    );
    RestAnomalyDetectorJobAction anomalyDetectorJobAction = new RestAnomalyDetectorJobAction(
        settings,
        clusterService,
        anomalyDetectionIndices
    );

    return ImmutableList
        .of(
            restGetAnomalyDetectorAction,
            restIndexAnomalyDetectorAction,
            searchAnomalyDetectorAction,
            searchAnomalyResultAction,
            deleteAnomalyDetectorAction,
            executeAnomalyDetectorAction,
            anomalyDetectorJobAction,
            statsAnomalyDetectorAction
        );
}