Search code examples
djangoelasticsearchsearch-enginedjango-haystack

AttributeError: 'ElasticSearch' object has no attribute 'bulk_index'"


When I try python manage.py rebuild_index, error occur:

self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID)   
AttributeError: 'ElasticSearch' object has no attribute 'bulk_index'

I found the link https://github.com/toastdriven/pyelasticsearch/blob/master/pyelasticsearch.py#L424-469 with pyelasticsearch.py, and I dont know which edition it is. Anyway there is bulk_index in that code, buy my pyelasticsearch.py is not. Anyone has the same experience? thanks for ur time.

Plus: django-haystack 2.0.0.beta, pyelasticsearch 0.0.6


Solution

  • Django-haystack will NOT work with original pyelasticsearch. You need to use toastdrivens' fork instead: https://github.com/toastdriven/pyelasticsearch If you use pip, just type:

    pip uninstall pyelasticsearch
    pip install git+git://github.com/toastdriven/pyelasticsearch.git