Search in sources :

Example 21 with AnalysisRegistry

use of org.elasticsearch.index.analysis.AnalysisRegistry in project elasticsearch by elastic.

the class AnalysisModuleTests method testAnalyzerAliasDefault.

public void testAnalyzerAliasDefault() throws IOException {
    Settings settings = Settings.builder().put("index.analysis.analyzer.foobar.alias", "default").put("index.analysis.analyzer.foobar.type", "keyword").put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.V_2_3_5)).build();
    AnalysisRegistry newRegistry = getNewRegistry(settings);
    IndexAnalyzers indexAnalyzers = getIndexAnalyzers(newRegistry, settings);
    assertThat(indexAnalyzers.get("default").analyzer(), is(instanceOf(KeywordAnalyzer.class)));
    assertThat(indexAnalyzers.get("default_search").analyzer(), is(instanceOf(KeywordAnalyzer.class)));
    assertWarnings("setting [index.analysis.analyzer.foobar.alias] is only allowed on index [test] because it was created before " + "5.x; analyzer aliases can no longer be created on new indices.");
}
Also used : AnalysisRegistry(org.elasticsearch.index.analysis.AnalysisRegistry) IndexAnalyzers(org.elasticsearch.index.analysis.IndexAnalyzers) Settings(org.elasticsearch.common.settings.Settings) IndexSettings(org.elasticsearch.index.IndexSettings)

Aggregations

AnalysisRegistry (org.elasticsearch.index.analysis.AnalysisRegistry)21 Settings (org.elasticsearch.common.settings.Settings)13 ScriptSettings (org.elasticsearch.script.ScriptSettings)7 IndexSettings (org.elasticsearch.index.IndexSettings)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)5 IOException (java.io.IOException)4 IndexAnalyzers (org.elasticsearch.index.analysis.IndexAnalyzers)4 AlreadySetException (org.apache.lucene.util.SetOnce.AlreadySetException)3 EngineException (org.elasticsearch.index.engine.EngineException)3 AssertingDirectoryReader (org.apache.lucene.index.AssertingDirectoryReader)2 Term (org.apache.lucene.index.Term)2 BM25Similarity (org.apache.lucene.search.similarities.BM25Similarity)2 Similarity (org.apache.lucene.search.similarities.Similarity)2 Environment (org.elasticsearch.env.Environment)2 NamedAnalyzer (org.elasticsearch.index.analysis.NamedAnalyzer)2 DisabledQueryCache (org.elasticsearch.index.cache.query.DisabledQueryCache)2 Engine (org.elasticsearch.index.engine.Engine)2 ParsedDocument (org.elasticsearch.index.mapper.ParsedDocument)2 IndexingOperationListener (org.elasticsearch.index.shard.IndexingOperationListener)2 ShardId (org.elasticsearch.index.shard.ShardId)2