'Converts this instance into an Elasticsearch document'

@classmethod
def extract_document(cls, pk=None, obj=None):

    if (obj is None):
        obj = cls.get_model().objects.get(pk=pk)
    attach_trans_dict(cls.get_model(), [obj])
    attrs = ('author', 'created', 'default_language', 'icon_hash', 'id', 'last_updated', 'modified', 'slug', 'status')
    doc = dict(zip(attrs, attrgetter(*attrs)(obj)))
    doc['device'] = obj.devices
    doc['guid'] = unicode(obj.uuid)
    doc['is_deleted'] = obj.deleted
    doc['is_disabled'] = obj.disabled
    if (obj.status == STATUS_PUBLIC):
        doc['latest_public_version'] = {'id': obj.latest_public_version.pk, 'created': obj.latest_public_version.created, 'size': obj.latest_public_version.size, 'version': obj.latest_public_version.version}
    else:
        doc['latest_public_version'] = None
    doc['name_sort'] = unicode(obj.name).lower()
    doc['reviewed'] = obj.versions.public().aggregate(Min('reviewed')).get('reviewed__min')
    doc.update(cls.extract_popularity_trending_boost(obj))
    for field in cls.translated_fields:
        doc.update(cls.extract_field_translations(obj, field, include_field_for_search=True))
    for field in cls.fields_with_language_analyzers:
        doc.update(cls.extract_field_analyzed_translations(obj, field))
    return doc
