Search in sources :

Example 21 with ClusterUpdateSettingsRequest

use of org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.

the class UpdateSettingsPlan method executeOrFail.

@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.nodeContext(), 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);
}
Also used : CrateSettings(io.crate.metadata.settings.CrateSettings) Collection(java.util.Collection) Function(java.util.function.Function) Lists2(io.crate.common.collections.Lists2) RowConsumer(io.crate.data.RowConsumer) DependencyCarrier(io.crate.planner.DependencyCarrier) Assignment(io.crate.sql.tree.Assignment) SymbolEvaluator(io.crate.analyze.SymbolEvaluator) ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Settings(org.elasticsearch.common.settings.Settings) Row(io.crate.data.Row) Symbol(io.crate.expression.symbol.Symbol) PlannerContext(io.crate.planner.PlannerContext) Plan(io.crate.planner.Plan) SubQueryResults(io.crate.planner.operators.SubQueryResults) ClusterUpdateSettingsResponse(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse) VisibleForTesting(io.crate.common.annotations.VisibleForTesting) OneRowActionListener(io.crate.execution.support.OneRowActionListener) Row1(io.crate.data.Row1) Row1(io.crate.data.Row1) OneRowActionListener(io.crate.execution.support.OneRowActionListener) ClusterUpdateSettingsResponse(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse) ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)

Example 22 with ClusterUpdateSettingsRequest

use of org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project graylog2-server by Graylog2.

the class ClientES7 method putSetting.

@Override
public void putSetting(String setting, String value) {
    final ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
    request.persistentSettings(Settings.builder().put(setting, value));
    client.execute((c, requestOptions) -> c.cluster().putSettings(request, requestOptions), "Unable to update ES cluster setting: " + setting + "=" + value);
}
Also used : ClusterUpdateSettingsRequest(org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)

Aggregations

ClusterUpdateSettingsRequest (org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)21 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)9 Settings (org.elasticsearch.common.settings.Settings)9 Test (org.junit.Test)9 ClusterUpdateSettingsResponse (org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse)7 VisibleForTesting (io.crate.common.annotations.VisibleForTesting)6 Row (io.crate.data.Row)5 Row1 (io.crate.data.Row1)5 RowConsumer (io.crate.data.RowConsumer)5 OneRowActionListener (io.crate.execution.support.OneRowActionListener)5 DependencyCarrier (io.crate.planner.DependencyCarrier)5 Plan (io.crate.planner.Plan)5 PlannerContext (io.crate.planner.PlannerContext)5 SubQueryResults (io.crate.planner.operators.SubQueryResults)5 SymbolEvaluator (io.crate.analyze.SymbolEvaluator)4 Symbol (io.crate.expression.symbol.Symbol)4 Function (java.util.function.Function)4 FulltextAnalyzerResolver (io.crate.metadata.FulltextAnalyzerResolver)3 ANALYZER (io.crate.metadata.FulltextAnalyzerResolver.CustomType.ANALYZER)3 CHAR_FILTER (io.crate.metadata.FulltextAnalyzerResolver.CustomType.CHAR_FILTER)3