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