Add each mapping at most once on batch mapping updates
When creating an index on master for the purpose of updating mappings, a mapping being updated could needlessly be merged multiple times. This commit ensures that each mapping is merged at most once while preparing to update mappings.
This commit is contained in:
parent
09006ace11
commit
13dbed9c92
|
@ -243,8 +243,9 @@ public class MetaDataMappingService extends AbstractComponent {
|
||||||
} else {
|
} else {
|
||||||
indexService = indicesService.indexService(index);
|
indexService = indicesService.indexService(index);
|
||||||
}
|
}
|
||||||
// only add the current relevant mapping (if exists)
|
// only add the current relevant mapping (if exists and not yet added)
|
||||||
if (indexMetaData.getMappings().containsKey(request.type())) {
|
if (indexMetaData.getMappings().containsKey(request.type()) &&
|
||||||
|
!indexService.mapperService().hasMapping(request.type())) {
|
||||||
indexService.mapperService().merge(request.type(), indexMetaData.getMappings().get(request.type()).source(), false, request.updateAllTypes());
|
indexService.mapperService().merge(request.type(), indexMetaData.getMappings().get(request.type()).source(), false, request.updateAllTypes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue