Search in sources :

Example 11 with ClusterUpdateSettingsRequest

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

the class CreateAnalyzerAnalyzerTest method testCreateAnalyzerWithCharFilters.

@Test
public void testCreateAnalyzerWithCharFilters() throws Exception {
    ClusterUpdateSettingsRequest request = analyze("CREATE ANALYZER a3 (" + "   TOKENIZER lowercase," + "   CHAR_FILTERS (" + "       \"html_strip\"," + "       my_mapping WITH (" + "           type='mapping'," + "           mappings=['ph=>f', 'ß=>ss', 'ö=>oe']" + "       )" + "   )" + ")");
    assertThat(extractAnalyzerSettings("a3", request.persistentSettings()), allOf(hasEntry("index.analysis.analyzer.a3.tokenizer", "lowercase"), hasEntry("index.analysis.analyzer.a3.char_filter", "[html_strip, a3_my_mapping]")));
    var charFiltersSettings = FulltextAnalyzerResolver.decodeSettings(request.persistentSettings().get(CHAR_FILTER.buildSettingName("a3_my_mapping")));
    assertThat(charFiltersSettings, allOf(hasEntry("index.analysis.char_filter.a3_my_mapping.mappings", "[ph=>f, ß=>ss, ö=>oe]"), hasEntry("index.analysis.char_filter.a3_my_mapping.type", "mapping")));
}
Also used : ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 12 with ClusterUpdateSettingsRequest

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

the class CreateAnalyzerAnalyzerTest method testCreateAnalyzerWithTokenFilters.

@Test
public void testCreateAnalyzerWithTokenFilters() throws Exception {
    ClusterUpdateSettingsRequest request = analyze("CREATE ANALYZER a11 (" + "  TOKENIZER standard," + "  TOKEN_FILTERS (" + "    lowercase," + "    mystop WITH (" + "      type='stop'," + "      stopword=['the', 'over']" + "    )" + "  )" + ")");
    assertThat(extractAnalyzerSettings("a11", request.persistentSettings()), allOf(hasEntry("index.analysis.analyzer.a11.tokenizer", "standard"), hasEntry("index.analysis.analyzer.a11.filter", "[lowercase, a11_mystop]")));
    var tokenFiltersSettings = FulltextAnalyzerResolver.decodeSettings(request.persistentSettings().get(TOKEN_FILTER.buildSettingName("a11_mystop")));
    assertThat(tokenFiltersSettings, allOf(hasEntry("index.analysis.filter.a11_mystop.type", "stop"), hasEntry("index.analysis.filter.a11_mystop.stopword", "[the, over]")));
}
Also used : ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 13 with ClusterUpdateSettingsRequest

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

the class CreateAnalyzerAnalyzerTest method testCreateAnalyzerExtendingBuiltin.

@Test
public void testCreateAnalyzerExtendingBuiltin() throws Exception {
    ClusterUpdateSettingsRequest request = analyze("CREATE ANALYZER a4 EXTENDS " + "german WITH (" + "   \"stop_words\"=['der', 'die', 'das']" + ")");
    assertThat(extractAnalyzerSettings("a4", request.persistentSettings()), allOf(hasEntry("index.analysis.analyzer.a4.stop_words", "[der, die, das]"), hasEntry("index.analysis.analyzer.a4.type", "german")));
}
Also used : ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 14 with ClusterUpdateSettingsRequest

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

the class DropAnalyzerTest method testDropAnalyzer.

@Test
public void testDropAnalyzer() {
    ClusterUpdateSettingsRequest request = analyze("DROP ANALYZER a1");
    assertIsMarkedToBeRemove(request.persistentSettings(), ANALYZER.buildSettingName("a1"));
}
Also used : ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 15 with ClusterUpdateSettingsRequest

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

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