def get_from_instance(self, instance):
        """
        Given an object to index with ES, return the value that should be put
        into ES for this field
        """
        # walk the attribute path to get the value. Similarly to Django, first
        # try getting the value from a dict, then as a attribute lookup, and
        # then as a list index
        for attr in self._path:
            try: # dict lookup
                instance = instance[attr]
            except (TypeError, AttributeError, KeyError, ValueError, IndexError):
                try: # attr lookup
                    instance = getattr(instance, attr)
                except (TypeError, AttributeError):
                    try:  # list-index lookup
                        instance = instance[int(attr)]
                    except (IndexError,  # list index out of range
                            ValueError,  # invalid literal for int()
                            KeyError,    # current is a dict without `int(bit)` key
                            TypeError):  # unsubscriptable object
                                raise VariableLookupError("Failed lookup for key [%s] in %r" % (attr, instance))

            if callable(instance):
                instance = instance()
            elif instance is None:  # no sense walking down the path any further
                return None

        return instance
Given an object to index with ES, return the value that should be put
        into ES for this field