def _check_mappings(self, doc_type, body):
<EOL>exclude_fields = ["<STR_LIT:content>"]<EOL>field_properties = getattr(settings, "<STR_LIT>", {})<EOL>def field_property(field_name, field_value):<EOL><INDENT>"""<STR_LIT>"""<EOL>prop_val = None<EOL>if field_name in field_properties:<EOL><INDENT>prop_val = field_properties[field_name]<EOL><DEDENT>elif isinstance(field_value, dict):<EOL><INDENT>props = {fn: field_property(fn, field_value[fn]) for fn in field_value}<EOL>prop_val = {"<STR_LIT>": props}<EOL><DEDENT>else:<EOL><INDENT>prop_val = {<EOL>"<STR_LIT:type>": "<STR_LIT:string>",<EOL>"<STR_LIT:index>": "<STR_LIT>",<EOL>}<EOL><DEDENT>return prop_val<EOL><DEDENT>new_properties = {<EOL>field: field_property(field, value)<EOL>for field, value in body.items()<EOL>if (field not in exclude_fields) and (field not in self._get_mappings(doc_type).get('<STR_LIT>', {}))<EOL>}<EOL>if new_properties:<EOL><INDENT>self._es.indices.put_mapping(<EOL>index=self.index_name,<EOL>doc_type=doc_type,<EOL>body={<EOL>doc_type: {<EOL>"<STR_LIT>": new_properties,<EOL>}<EOL>}<EOL>)<EOL>self._clear_mapping(doc_type)<EOL><DEDENT>
We desire to index content so that anything we want to be textually searchable(and therefore needing to be
analysed), but the other fields are designed to be filters, and only require an exact match. So, we want to
set up the mappings for these fields as "not_analyzed" - this will allow our filters to work faster because
they only have to work off exact matches