I have many questions regarding elasticutils and not sure if creating an issue for each question in the github or not.
Question 1.
When you create a mapping for a django model, and the model has a foreign key,
can you return a dictionary for the foreign key in extract_document()?
@classmethod
def extract_document(cls, obj_id, obj=None):
if obj is None:
obj = cls.get_model().objects.get(pk=obj_id)
return {
'id': obj.id,
'title': obj.title,
'main_post': {
'id': obj.main_post.id,
'raw_html': obj.main_post.raw_html,
'user_id': obj.main_post.user.id
},
'deleted': obj.deleted
}
Question 2.
Is there an equivalent of haystack's load_all()
in elasticutils?