'Migrate a ES mapping
:param mapping: new mapping
:param index: index of old mapping
:param doc_type: type of old mapping
:return: The diff mapping'

def migrate(self, mapping, index, doc_type):

    old_mapping = self.get_doctype(index, doc_type)
    if (not old_mapping):
        self.connection.indices.put_mapping(doc_type=doc_type, mapping=mapping, indices=index)
        return mapping
    mapping_diff = old_mapping.get_diff(mapping)
    if (not mapping_diff):
        return None
    from pprint import pprint
    pprint(mapping_diff.as_dict())
    mapping_diff.connection = old_mapping.connection
    mapping_diff.save()
