def handle(self, *args, **options): Blog.es.reindex_all() index_name = Blog.es.index current_doc_type = Blog.es.doc_type # Index all file fields for blog in Blog.objects.all(): current = blog.es.get(id=blog.id) current['cover_image'] = blog.cover_image_path es_client.index(index=index_name, doc_type=current_doc_type, id=blog.id, body=current) print "Completed Indexing"
def do_index(self): body = self.serialize() es_client.index(index=self.index, doc_type=self.doc_type, id=self.instance.id, body=body)