'Given two mapping it extracts a schema evolution mapping. Returns None if no evolutions are required
:param new_mapping: the new mapping
:return: a new evolution mapping or None'

def get_diff(self, new_mapping):

    import copy
    result = copy.deepcopy(new_mapping)
    result.clear_properties()
    no_check_types = (BooleanField, IntegerField, FloatField, DateField, LongField, BinaryField, GeoPointField, IpField)
    old_fields = set(self.properties.keys())
    new_fields = set(new_mapping.properties.keys())
    added = (new_fields - old_fields)
    if added:
        for add in added:
            result.add_property(new_mapping.properties[add])
    common_fields = (new_fields & old_fields)
    common_fields = [c for c in common_fields if (not isinstance(new_mapping.properties[c], no_check_types))]
    for field in common_fields:
        prop = new_mapping.properties[field]
        if isinstance(prop, StringField):
            continue
        if isinstance(prop, MultiField):
            diff = prop.get_diff(self.properties[field])
            if diff:
                result.add_property(diff)
        elif isinstance(prop, ObjectField):
            diff = self.properties[field].get_diff(prop)
            if diff:
                result.add_property(diff)
    if (len(result.properties) > 0):
        return result
    return None
