Search in sources :

Example 11 with MapperRegistry

use of org.elasticsearch.indices.mapper.MapperRegistry in project elasticsearch by elastic.

the class IndicesModuleTests method testBuiltinWithPlugins.

public void testBuiltinWithPlugins() {
    IndicesModule module = new IndicesModule(fakePlugins);
    MapperRegistry registry = module.getMapperRegistry();
    assertThat(registry.getMapperParsers().size(), Matchers.greaterThan(1));
    assertThat(registry.getMetadataMapperParsers().size(), Matchers.greaterThan(1));
}
Also used : MapperRegistry(org.elasticsearch.indices.mapper.MapperRegistry)

Example 12 with MapperRegistry

use of org.elasticsearch.indices.mapper.MapperRegistry 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

MapperRegistry (org.elasticsearch.indices.mapper.MapperRegistry)12 Settings (org.elasticsearch.common.settings.Settings)5 QueryShardContext (org.elasticsearch.index.query.QueryShardContext)5 Version (org.elasticsearch.Version)4 CompressedXContent (org.elasticsearch.common.compress.CompressedXContent)4 IndexService (org.elasticsearch.index.IndexService)4 HashMap (java.util.HashMap)2 IndexableField (org.apache.lucene.index.IndexableField)2 GeoPoint (org.elasticsearch.common.geo.GeoPoint)2 IndexAnalyzers (org.elasticsearch.index.analysis.IndexAnalyzers)2 MapperService (org.elasticsearch.index.mapper.MapperService)2 SimilarityService (org.elasticsearch.index.similarity.SimilarityService)2 BytesRef (org.apache.lucene.util.BytesRef)1 BytesArray (org.elasticsearch.common.bytes.BytesArray)1 IndexSettings (org.elasticsearch.index.IndexSettings)1 DocumentMapperParser (org.elasticsearch.index.mapper.DocumentMapperParser)1 IndicesModule (org.elasticsearch.indices.IndicesModule)1 Before (org.junit.Before)1