when replacing a mapping, clear the aggregated mapping information and then readd it

This commit is contained in:
kimchy 2010-12-23 11:32:16 +02:00
parent 473c2fa8f4
commit 5a58ed4274

View File

@ -149,6 +149,7 @@ public class MapperService extends AbstractIndexComponent implements Iterable<Do
if (mapper.type().charAt(0) == '_') { if (mapper.type().charAt(0) == '_') {
throw new InvalidTypeNameException("Document mapping type name can't start with '_'"); throw new InvalidTypeNameException("Document mapping type name can't start with '_'");
} }
remove(mapper.type()); // first remove it (in case its an update, we need to remove the aggregated mappers)
mappers = newMapBuilder(mappers).put(mapper.type(), mapper).immutableMap(); mappers = newMapBuilder(mappers).put(mapper.type(), mapper).immutableMap();
mapper.addFieldMapperListener(fieldMapperListener, true); mapper.addFieldMapperListener(fieldMapperListener, true);
} }