【问题标题】:AttributeError: 'ElasticSearch' object has no attribute 'bulk_index'"AttributeError: 'ElasticSearch' 对象没有属性 'bulk_index'"
【发布时间】:2012-08-11 09:33:00
【问题描述】:

当我尝试python manage.py rebuild_index 时,出现错误:

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

我找到了带有pyelasticsearch.py​​的链接https://github.com/toastdriven/pyelasticsearch/blob/master/pyelasticsearch.py#L424-469,但我不知道它是哪个版本。无论如何,该代码中有bulk_index,买我的pyelasticsearch.py​​ 不是。 有人有同样的经历吗?谢谢你的时间。

加: django-haystack 2.0.0.beta,pyelasticsearch 0.0.6

【问题讨论】:

  • @Efazati,怎么警告?
  • 哦,我以前从未标记过accept。我现在就这样做。

标签: django elasticsearch search-engine django-haystack


【解决方案1】:

Django-haystack 不适用于原始 pyelasticsearch。您需要改用 toastdrivens 的 fork:https://github.com/toastdriven/pyelasticsearch 如果你使用 pip,只需输入:

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

【讨论】:

  • 我已经下载了 pyelasticsearch 与 :git clone https://github.com/toastdriven/pyelasticsearch.git。我得到了0.0.6。现在我选择branch(我忘记了我选择了哪个分支,可能是masterbulk_index。无论如何bulk_indexprepare_body 中的参数prepare_body。)我用zip 包下载。我发现版本是0.0.5,安装后使用python setup.py install。它有效。
  • 你的意思是我应该选择分支?但是你怎么知道应该选择哪个分支? @jasisz
  • 哦,这个(https://github.com/rhec/pyelasticsearch.git)是我第一次下载的,也就是original那个。
  • 这不再是一个问题,haystack 自己的文档提到现在使用 pip install pyelasticsearch。 django-haystack.readthedocs.org/en/latest/…
猜你喜欢
  • 2022-06-23
  • 2012-12-01
  • 2021-04-19
  • 2021-11-22
  • 1970-01-01
  • 1970-01-01
  • 2018-08-28
  • 1970-01-01
相关资源
最近更新 更多