Search in sources :

Example 11 with IndexAnalyzers

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

the class MapperTestUtils method newMapperService.

public static MapperService newMapperService(NamedXContentRegistry xContentRegistry, Path tempDir, Settings settings, IndicesModule indicesModule) throws IOException {
    Settings.Builder settingsBuilder = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), tempDir).put(settings);
    if (settings.get(IndexMetaData.SETTING_VERSION_CREATED) == null) {
        settingsBuilder.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT);
    }
    Settings finalSettings = settingsBuilder.build();
    MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
    IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", finalSettings);
    IndexAnalyzers indexAnalyzers = createTestAnalysis(indexSettings, finalSettings).indexAnalyzers;
    SimilarityService similarityService = new SimilarityService(indexSettings, Collections.emptyMap());
    return new MapperService(indexSettings, indexAnalyzers, xContentRegistry, similarityService, mapperRegistry, () -> null);
}
Also used : MapperRegistry(org.elasticsearch.indices.mapper.MapperRegistry) SimilarityService(org.elasticsearch.index.similarity.SimilarityService) IndexAnalyzers(org.elasticsearch.index.analysis.IndexAnalyzers) Settings(org.elasticsearch.common.settings.Settings) MapperService(org.elasticsearch.index.mapper.MapperService)

Aggregations

IndexAnalyzers (org.elasticsearch.index.analysis.IndexAnalyzers)11 Settings (org.elasticsearch.common.settings.Settings)8 IndexSettings (org.elasticsearch.index.IndexSettings)7 Analyzer (org.apache.lucene.analysis.Analyzer)4 AnalysisRegistry (org.elasticsearch.index.analysis.AnalysisRegistry)4 NamedAnalyzer (org.elasticsearch.index.analysis.NamedAnalyzer)4 SimilarityService (org.elasticsearch.index.similarity.SimilarityService)4 MapperService (org.elasticsearch.index.mapper.MapperService)3 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)2 MapperRegistry (org.elasticsearch.indices.mapper.MapperRegistry)2 AbstractMap (java.util.AbstractMap)1 HashSet (java.util.HashSet)1 KeywordAnalyzer (org.apache.lucene.analysis.core.KeywordAnalyzer)1 GermanAnalyzer (org.apache.lucene.analysis.de.GermanAnalyzer)1 EnglishAnalyzer (org.apache.lucene.analysis.en.EnglishAnalyzer)1 CompressedXContent (org.elasticsearch.common.compress.CompressedXContent)1 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)1 Index (org.elasticsearch.index.Index)1 CustomAnalyzer (org.elasticsearch.index.analysis.CustomAnalyzer)1 MappingCharFilterFactory (org.elasticsearch.index.analysis.MappingCharFilterFactory)1