index_queryset中的Django-Haystack elasticsearch错误

时间:2013-02-11 10:24:51

标签: elasticsearch django-haystack

当试图在django-haystack上为elasticsearch构建索引时,我得到错误(下面的完整回溯)

TypeError: index_queryset() got an unexpected keyword argument 'using'

它在Python 2.6,Django 1.4,ElasticSearch 0.20.2上。以前我遇到过类似的prefetch error,这是pyelasticsearch和请求库之间版本不匹配的情况。我试图将请求降级到0.13,但没有效果。 pyelasticsearch目前为0.3

非常感谢任何帮助!

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 184, in handle
    return super(Command, self).handle(*items, **options)
  File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 341, in handle
    label_output = self.handle_label(label, **options)
  File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 210, in handle_label
    self.update_backend(label, using)
  File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 239, in update_backend
    end_date=self.end_date)
  File "/var/www/myproj/myproj-env/src/django-haystack/haystack/indexes.py", line 157, in build_queryset
    index_qs = self.index_queryset(using=using)
TypeError: index_queryset() got an unexpected keyword argument 'using'

1 个答案:

答案 0 :(得分:0)

问题在于django-haystack的版本。目前的版本是0.3,而几个月前它是1.0,这有点误解。

我解决问题的方法简单明了 - 安装最新版本(0.3),然后获取旧版本(在本例中为1.0)并简单地覆盖haystack源。

结论:“旧版1.0”与所有先决条件的最新版本(pyelasticsearch,simplejson和requests)一起顺利运行,而“较新的0.3”不会