def configure_field(self, field):
        """This configures an Elasticsearch Mapping field, based on a Django model field"""
        from .models import Indexable

        # This is for reverse relations, which do not have a db column
        if field.auto_created and field.is_relation:
            if isinstance(field, (ForeignObjectRel, ManyToOneRel)) and issubclass(field.related_model, Indexable):
                related_properties = field.related_model.search_objects.mapping.properties.properties.to_dict()
                self.field(field.name, {"type": "nested", "properties": related_properties})
                return

        if field.get_internal_type() == "ManyToManyField" and issubclass(field.rel.to, Indexable):

            related_properties = field.rel.to.search_objects.mapping.properties.properties.to_dict()
            self.field(field.name, {"type": "nested", "properties": related_properties})
            return

        if isinstance(field, models.ForeignKey):
            # This is a related field, so it should maybe be nested?

            # We only want to nest fields when they are indexable, and not parent pointers.
            if issubclass(field.rel.to, Indexable) and not field.rel.parent_link:

                related_properties = field.rel.to.search_objects.mapping.properties.properties.to_dict()
                self.field(field.name, {"type": "nested", "properties": related_properties})
                return

        db_column, attname = field.db_column, field.attname

        field_args = FIELD_MAPPINGS.get(field.get_internal_type())
        if field_args:
            self.field(db_column or attname, field_args)
        else:
            raise Warning("Can't find {}".format(field.get_internal_type()))
This configures an Elasticsearch Mapping field, based on a Django model field