use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class DropAnalyzerPlan method createRequest.
@VisibleForTesting
public static ClusterUpdateSettingsRequest createRequest(String analyzerName, FulltextAnalyzerResolver ftResolver) {
Settings.Builder builder = Settings.builder();
builder.putNull(ANALYZER.buildSettingName(analyzerName));
Settings settings = ftResolver.getCustomAnalyzer(analyzerName);
String tokenizerName = settings.get(ANALYZER.buildSettingChildName(analyzerName, TOKENIZER.getName()));
if (tokenizerName != null && ftResolver.hasCustomThingy(tokenizerName, FulltextAnalyzerResolver.CustomType.TOKENIZER)) {
builder.putNull(TOKENIZER.buildSettingName(tokenizerName));
}
for (String tokenFilterName : settings.getAsList(ANALYZER.buildSettingChildName(analyzerName, TOKEN_FILTER.getName()))) {
if (ftResolver.hasCustomThingy(tokenFilterName, FulltextAnalyzerResolver.CustomType.TOKEN_FILTER)) {
builder.putNull(TOKEN_FILTER.buildSettingName(tokenFilterName));
}
}
for (String charFilterName : settings.getAsList(ANALYZER.buildSettingChildName(analyzerName, CHAR_FILTER.getName()))) {
if (ftResolver.hasCustomThingy(charFilterName, FulltextAnalyzerResolver.CustomType.CHAR_FILTER)) {
builder.putNull(CHAR_FILTER.buildSettingName(charFilterName));
}
}
return new ClusterUpdateSettingsRequest().persistentSettings(builder.build());
}
use of org.graylog.shaded.elasticsearch7.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);
}
use of org.graylog.shaded.elasticsearch7.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);
}
Aggregations