org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse Java Examples

The following examples show how to use org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse. 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: CaseController.java    From skywalking with Apache License 2.0 6 votes vote down vote up
private void putSettings() throws IOException {
    ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
    String transientSettingKey =
        RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey();
    int transientSettingValue = 10;
    Settings transientSettings = Settings.builder()
            .put(transientSettingKey, transientSettingValue, ByteSizeUnit.BYTES)
            .build();
    request.transientSettings(transientSettings);
    ClusterUpdateSettingsResponse response = client.cluster().putSettings(request, RequestOptions.DEFAULT);
    if (response == null) {
        String message = "elasticsearch put settings fail.";
        logger.error(message);
        throw new RuntimeException(message);
    }
}
 
Example #2
Source File: ResetSettingsPlan.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public void executeOrFail(DependencyCarrier dependencies,
                          PlannerContext plannerContext,
                          RowConsumer consumer,
                          Row params,
                          SubQueryResults subQueryResults) {

    Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(plannerContext.transactionContext(),
                                                                          plannerContext.functions(),
                                                                          x,
                                                                          params,
                                                                          subQueryResults);

    Settings settings = buildSettingsFrom(resetAnalyzedStatement.settingsToRemove(), eval);

    ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest()
        .persistentSettings(settings)
        .transientSettings(settings);
    OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(
        consumer,
        r -> r.isAcknowledged() ? new Row1(1L) : new Row1(0L));
    dependencies.transportActionProvider().transportClusterUpdateSettingsAction().execute(request, actionListener);
}
 
Example #3
Source File: UpdateSettingsPlan.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public void executeOrFail(DependencyCarrier dependencies,
                          PlannerContext plannerContext,
                          RowConsumer consumer,
                          Row params,
                          SubQueryResults subQueryResults) {

    Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(plannerContext.transactionContext(),
                                                                          plannerContext.functions(),
                                                                          x,
                                                                          params,
                                                                          subQueryResults);
    ClusterUpdateSettingsRequest request = isPersistent
        ? new ClusterUpdateSettingsRequest().persistentSettings(buildSettingsFrom(settings, eval))
        : new ClusterUpdateSettingsRequest().transientSettings(buildSettingsFrom(settings, eval));

    OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(
        consumer,
        r -> r.isAcknowledged() ? new Row1(1L) : new Row1(0L));
    dependencies.transportActionProvider().transportClusterUpdateSettingsAction().execute(request, actionListener);
}
 
Example #4
Source File: DecommissioningService.java    From crate with Apache License 2.0 6 votes vote down vote up
private CompletableFuture<ClusterUpdateSettingsResponse> clusterSetDecommissionNodeSetting() {
    if (dataAvailability == DataAvailability.NONE) {
        return CompletableFuture.completedFuture(null);
    }

    /*
     * setting this setting will cause the {@link DecommissionAllocationDecider} to prevent allocations onto this node
     *
     * nodeIds are part of the key to prevent conflicts if other nodes are being decommissioned in parallel
     */
    Settings settings = Settings.builder().put(
        DECOMMISSION_PREFIX + clusterService.localNode().getId(), true).build();
    FutureActionListener<ClusterUpdateSettingsResponse, ClusterUpdateSettingsResponse> settingsResponseFutureListener
        = FutureActionListener.newInstance();
    updateSettingsAction.execute(
        new ClusterUpdateSettingsRequest().transientSettings(settings), settingsResponseFutureListener);
    return settingsResponseFutureListener;
}
 
Example #5
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<ClusterUpdateSettingsResponse> updateSettings(final ClusterUpdateSettingsRequest request) {
    return execute(ClusterUpdateSettingsAction.INSTANCE, request);
}
 
Example #6
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void updateSettings(final ClusterUpdateSettingsRequest request, final ActionListener<ClusterUpdateSettingsResponse> listener) {
    execute(ClusterUpdateSettingsAction.INSTANCE, request, listener);
}
 
Example #7
Source File: UpdateClusterSettingsRequestBuilder.java    From elasticshell with Apache License 2.0 4 votes vote down vote up
@Override
protected ActionFuture<ClusterUpdateSettingsResponse> doExecute(ClusterUpdateSettingsRequest request) {
    return client.admin().cluster().updateSettings(request);
}
 
Example #8
Source File: ClusterAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Updates settings in the cluster.
 */
ActionFuture<ClusterUpdateSettingsResponse> updateSettings(ClusterUpdateSettingsRequest request);
 
Example #9
Source File: ClusterAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Update settings in the cluster.
 */
void updateSettings(ClusterUpdateSettingsRequest request, ActionListener<ClusterUpdateSettingsResponse> listener);