use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class CreateAnalyzerAnalyzerTest method testCreateAnalyzerSimple.
@Test
public void testCreateAnalyzerSimple() throws Exception {
ClusterUpdateSettingsRequest request = analyze("CREATE ANALYZER a1 (TOKENIZER lowercase)");
assertThat(extractAnalyzerSettings("a1", request.persistentSettings()), allOf(hasEntry("index.analysis.analyzer.a1.tokenizer", "lowercase"), hasEntry("index.analysis.analyzer.a1.type", "custom")));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class CreateAnalyzerAnalyzerTest method testCreateAnalyzerWithCustomTokenizer.
@Test
public void testCreateAnalyzerWithCustomTokenizer() throws Exception {
ClusterUpdateSettingsRequest request = analyze("CREATE ANALYZER a2 (" + " TOKENIZER tok2 with (" + " type='ngram'," + " \"min_ngram\"=2," + " \"token_chars\"=['letter', 'digits']" + " )" + ")");
assertThat(extractAnalyzerSettings("a2", request.persistentSettings()), allOf(hasEntry("index.analysis.analyzer.a2.tokenizer", "a2_tok2"), hasEntry("index.analysis.analyzer.a2.type", "custom")));
var tokenizerSettings = FulltextAnalyzerResolver.decodeSettings(request.persistentSettings().get(TOKENIZER.buildSettingName("a2_tok2")));
assertThat(tokenizerSettings, allOf(hasEntry("index.analysis.tokenizer.a2_tok2.min_ngram", "2"), hasEntry("index.analysis.tokenizer.a2_tok2.type", "ngram"), hasEntry("index.analysis.tokenizer.a2_tok2.token_chars", "[letter, digits]")));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class DropAnalyzerTest method testDropAnalyzerWithCustomTokenFilter.
@Test
public void testDropAnalyzerWithCustomTokenFilter() {
ClusterUpdateSettingsRequest request = analyze("DROP ANALYZER a3");
assertIsMarkedToBeRemove(request.persistentSettings(), ANALYZER.buildSettingName("a3"));
assertIsMarkedToBeRemove(request.persistentSettings(), TOKEN_FILTER.buildSettingName("a3_lowercase_german"));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class CreateAnalyzerTask method execute.
@Override
public void execute(BatchConsumer consumer, Row parameters) {
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
request.persistentSettings(plan.createAnalyzerSettings());
OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(consumer, TO_ONE_ROW);
transport.execute(request, actionListener);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest in project crate by crate.
the class ESClusterUpdateSettingsTask method buildESUpdateClusterSettingRequest.
private ClusterUpdateSettingsRequest buildESUpdateClusterSettingRequest(Settings persistentSettings, Settings transientSettings) {
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
request.persistentSettings(persistentSettings);
request.transientSettings(transientSettings);
if (plan.persistentSettingsToRemove() != null) {
request.persistentSettingsToRemove(plan.persistentSettingsToRemove());
}
if (plan.transientSettingsToRemove() != null) {
request.transientSettingsToRemove(plan.transientSettingsToRemove());
}
return request;
}
Aggregations