Search in sources :

Example 6 with ClusterUpdateSettingsRequest

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")));
}
Also used : ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 7 with ClusterUpdateSettingsRequest

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]")));
}
Also used : ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 8 with ClusterUpdateSettingsRequest

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"));
}
Also used : ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 9 with ClusterUpdateSettingsRequest

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);
}
Also used : OneRowActionListener(io.crate.executor.transport.OneRowActionListener) ClusterUpdateSettingsResponse(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse) ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)

Example 10 with ClusterUpdateSettingsRequest

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;
}
Also used : ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)

Aggregations

ClusterUpdateSettingsRequest (org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)22 Settings (org.elasticsearch.common.settings.Settings)10 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)9 Test (org.junit.Test)9 ClusterUpdateSettingsResponse (org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse)8 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