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")));
}
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]")));
}
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")));
}
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"));
}
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"));
}
Aggregations