Search in sources :

Example 6 with MapperPlugin

use of org.elasticsearch.plugins.MapperPlugin in project elasticsearch by elastic.

the class IndicesModuleTests method testDuplicateBuiltinMapper.

public void testDuplicateBuiltinMapper() {
    List<MapperPlugin> plugins = Arrays.asList(new MapperPlugin() {

        @Override
        public Map<String, Mapper.TypeParser> getMappers() {
            return Collections.singletonMap(TextFieldMapper.CONTENT_TYPE, new FakeMapperParser());
        }
    });
    IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new IndicesModule(plugins));
    assertThat(e.getMessage(), Matchers.containsString("already registered"));
}
Also used : Mapper(org.elasticsearch.index.mapper.Mapper) IdFieldMapper(org.elasticsearch.index.mapper.IdFieldMapper) FieldNamesFieldMapper(org.elasticsearch.index.mapper.FieldNamesFieldMapper) TextFieldMapper(org.elasticsearch.index.mapper.TextFieldMapper) MetadataFieldMapper(org.elasticsearch.index.mapper.MetadataFieldMapper) MapperPlugin(org.elasticsearch.plugins.MapperPlugin) Map(java.util.Map)

Example 7 with MapperPlugin

use of org.elasticsearch.plugins.MapperPlugin in project elasticsearch by elastic.

the class IndicesModuleTests method testDuplicateFieldNamesMapper.

public void testDuplicateFieldNamesMapper() {
    List<MapperPlugin> plugins = Arrays.asList(new MapperPlugin() {

        @Override
        public Map<String, MetadataFieldMapper.TypeParser> getMetadataMappers() {
            return Collections.singletonMap(FieldNamesFieldMapper.NAME, new FakeMetadataMapperParser());
        }
    });
    IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new IndicesModule(plugins));
    assertThat(e.getMessage(), Matchers.containsString("cannot contain metadata mapper [_field_names]"));
}
Also used : MetadataFieldMapper(org.elasticsearch.index.mapper.MetadataFieldMapper) MapperPlugin(org.elasticsearch.plugins.MapperPlugin) Map(java.util.Map)

Aggregations

MapperPlugin (org.elasticsearch.plugins.MapperPlugin)7 Map (java.util.Map)5 MetadataFieldMapper (org.elasticsearch.index.mapper.MetadataFieldMapper)3 LinkedHashMap (java.util.LinkedHashMap)2 FieldNamesFieldMapper (org.elasticsearch.index.mapper.FieldNamesFieldMapper)2 IdFieldMapper (org.elasticsearch.index.mapper.IdFieldMapper)2 TextFieldMapper (org.elasticsearch.index.mapper.TextFieldMapper)2 AllFieldMapper (org.elasticsearch.index.mapper.AllFieldMapper)1 BinaryFieldMapper (org.elasticsearch.index.mapper.BinaryFieldMapper)1 BooleanFieldMapper (org.elasticsearch.index.mapper.BooleanFieldMapper)1 CompletionFieldMapper (org.elasticsearch.index.mapper.CompletionFieldMapper)1 DateFieldMapper (org.elasticsearch.index.mapper.DateFieldMapper)1 GeoPointFieldMapper (org.elasticsearch.index.mapper.GeoPointFieldMapper)1 GeoShapeFieldMapper (org.elasticsearch.index.mapper.GeoShapeFieldMapper)1 IndexFieldMapper (org.elasticsearch.index.mapper.IndexFieldMapper)1 IpFieldMapper (org.elasticsearch.index.mapper.IpFieldMapper)1 KeywordFieldMapper (org.elasticsearch.index.mapper.KeywordFieldMapper)1 Mapper (org.elasticsearch.index.mapper.Mapper)1 NumberFieldMapper (org.elasticsearch.index.mapper.NumberFieldMapper)1 ObjectMapper (org.elasticsearch.index.mapper.ObjectMapper)1