Example #1
0
    def fields(self):
        """Returns a serialization of a Model instance.

        This can be used for indexing data.

        .. warning::
            It is recommended that you override this method and selectively
            serialize fields.
        """
        return djangoutils.get_values(self)
Example #2
0
 def update_index(self, es, bulk=False):
     data = djangoutils.get_values(self)
     try:
         es.index(data, settings.ES_INDEX, 'opinion', self.id, bulk=bulk)
     except Exception, e:
         log.error("ElasticSearch errored for opinion (%s): %s" % (self, e))