use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class DropAnalyzerTest method testDropAnalyzerWithCustomCharFilter.
@Test
public void testDropAnalyzerWithCustomCharFilter() {
ClusterUpdateSettingsRequest request = analyze("DROP ANALYZER a4");
assertIsMarkedToBeRemove(request.persistentSettings(), ANALYZER.buildSettingName("a4"));
assertIsMarkedToBeRemove(request.persistentSettings(), CHAR_FILTER.buildSettingName("a4_mymapping"));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class DropAnalyzerTest method testDropAnalyzerWithCustomTokenizer.
@Test
public void testDropAnalyzerWithCustomTokenizer() {
ClusterUpdateSettingsRequest request = analyze("DROP ANALYZER a2");
assertIsMarkedToBeRemove(request.persistentSettings(), ANALYZER.buildSettingName("a2"));
assertIsMarkedToBeRemove(request.persistentSettings(), TOKENIZER.buildSettingName("a2_mypattern"));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class CreateAnalyzerPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
ClusterUpdateSettingsRequest request = createRequest(createAnalyzer, plannerContext.transactionContext(), dependencies.nodeContext(), params, subQueryResults, dependencies.fulltextAnalyzerResolver());
dependencies.transportActionProvider().transportClusterUpdateSettingsAction().execute(request, new OneRowActionListener<>(consumer, r -> new Row1(1L)));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class CreateAnalyzerPlan method createRequest.
@VisibleForTesting
public static ClusterUpdateSettingsRequest createRequest(AnalyzedCreateAnalyzer createAnalyzer, CoordinatorTxnCtx txnCtx, NodeContext nodeCtx, Row parameters, SubQueryResults subQueryResults, FulltextAnalyzerResolver ftResolver) {
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(txnCtx, nodeCtx, x, parameters, subQueryResults);
var analyzerIdent = createAnalyzer.ident();
var tokenizer = bindTokenizer(createAnalyzer.tokenizer(), analyzerIdent, eval, ftResolver);
var tokenFilters = bindTokenFilters(createAnalyzer.tokenFilters(), analyzerIdent, eval, ftResolver);
var charFilters = bindCharFilters(createAnalyzer.charFilters(), analyzerIdent, eval, ftResolver);
var genericAnalyzerSettings = bindGenericAnalyzerProperties(createAnalyzer.genericAnalyzerProperties(), analyzerIdent, eval);
var analyzerSettings = buildAnalyzerSettings(analyzerIdent, createAnalyzer.extendedAnalyzerName(), tokenizer, tokenFilters, charFilters, genericAnalyzerSettings, ftResolver);
Settings.Builder encodedSettingsBuilder = Settings.builder();
encodedSettingsBuilder.put(ANALYZER.buildSettingName(analyzerIdent), encodeSettings(analyzerSettings).utf8ToString());
if (tokenizer != null && !tokenizer.v2().isEmpty()) {
encodedSettingsBuilder.put(TOKENIZER.buildSettingName(tokenizer.v1()), encodeSettings(tokenizer.v2()).utf8ToString());
}
for (Map.Entry<String, Settings> tokenFilter : tokenFilters.entrySet()) {
if (!tokenFilter.getValue().isEmpty()) {
encodedSettingsBuilder.put(TOKEN_FILTER.buildSettingName(tokenFilter.getKey()), encodeSettings(tokenFilter.getValue()).utf8ToString());
}
}
for (Map.Entry<String, Settings> charFilter : charFilters.entrySet()) {
if (!charFilter.getValue().isEmpty()) {
encodedSettingsBuilder.put(CHAR_FILTER.buildSettingName(charFilter.getKey()), encodeSettings(charFilter.getValue()).utf8ToString());
}
}
return new ClusterUpdateSettingsRequest().persistentSettings(encodedSettingsBuilder.build());
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class DropAnalyzerPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
ClusterUpdateSettingsRequest request = createRequest(dropAnalyzer.name(), dependencies.fulltextAnalyzerResolver());
dependencies.transportActionProvider().transportClusterUpdateSettingsAction().execute(request, new OneRowActionListener<>(consumer, r -> new Row1(1L)));
}
Aggregations