【问题标题】:Using django-elasticsearch-dsl with AWS ElasticSearch - raise HTTP_EXCEPTIONS.get(status_code, TransportError)将 django-elasticsearch-dsl 与 AWS ElasticSearch 一起使用 - 引发 HTTP_EXCEPTIONS.get(status_code, TransportError)
【发布时间】:2019-10-16 16:52:26
【问题描述】:

我正在尝试将使用 django-elasticsearch-dsl 和 elasticsearch 服务器的 Django 应用程序转换为使用我正在使用 ElsaticBeanStalk 部署的 AWS ElasticSearch

当我使用时

03_elasticsearch:   
    command: "source /opt/python/run/venv/bin/activate && ./src/manage.py search_index --rebuild -f"

我收到此错误

Creating index 'hjsm-local'
Traceback (most recent call last):
  File "./src/manage.py", line 10, in <module>
  execute_from_command_line(sys.argv)
  File "/opt/python/run/venv/local/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
  utility.execute()
  File "/opt/python/run/venv/local/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
  self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/python/run/venv/local/lib64/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
  self.execute(*args, **cmd_options)
  File "/opt/python/run/venv/local/lib64/python3.6/site-packages/django/core/management/base.py", line 353, in execute
  output = self.handle(*args, **options)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 134, in handle
  self._rebuild(models, options)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 114, in _rebuild
  self._create(models, options)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 84, in _create
  index.create()
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/elasticsearch_dsl/index.py", line 102, in create
  self.connection.indices.create(index=self._name, body=self.to_dict(), **kwargs)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped
  return func(*args, params=params, **kwargs)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/elasticsearch/client/indices.py", line 110, in create
  params=params, body=body)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/elasticsearch/transport.py", line 327, in perform_request
  status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 110, in perform_request
  self._raise_error(response.status, raw_data)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/elasticsearch/connection/base.py", line 114, in _raise_error
  raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
  elasticsearch.exceptions.TransportError: <exception str() failed>
   (ElasticBeanstalk::ExternalInvocationError)

我不明白这是在告诉我什么 - 任何人都可以建议吗?

更新

我认为我收到了 HTTP 406 错误,但我不明白为什么。如果我使用 localhost:9200 而不是我的 aws elelasticsearch 服务器在本地运行,它工作正常。

【问题讨论】:

  • 您可能需要检查您正在使用的 django-elasticsearch-dsl 版本是否支持您正在使用的 AWS ES 版本
  • 我得出了同样的结论。我认为当前系统使用的是 elasticsearch2.4(这很令人惊讶,因为它使用的是 django2.1)。我正在尝试找到一个提供 2.4 的 elasticsearch 服务,所以我不需要自己鼓动它

标签: django elasticsearch


【解决方案1】:

问题是它需要 ElasticSearch 2.4。我必须设置一个运行这个的服务器,当我通过它连接时!

【讨论】:

    猜你喜欢
    • 2021-06-09
    • 2019-04-17
    • 1970-01-01
    • 2021-04-15
    • 2018-04-09
    • 2017-01-22
    • 2015-02-01
    • 2021-07-08
    • 2019-03-29
    相关资源
    最近更新 更多