Django elasticsearch 传输错误找不到查询

Django elasticsearch transport error no query found

我遵循以下教程: http://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-part-two.html http://www.techstricks.com/django-haystack-and-elasticsearch-tutorial/

一切正常,但是当我尝试从搜索框中查询内容时,它显示未找到任何结果,并且在控制台中出现此错误。

INFO base GET http://127.0.0.1:9200/haystack/_mapping [status:200 request:0.015s]
INFO base PUT http://127.0.0.1:9200/haystack [status:400 request:0.018s]
INFO base PUT http://127.0.0.1:9200/haystack/_mapping/modelresult [status:200 request:0.023s]
WARNING base GET http://127.0.0.1:9200/haystack/modelresult/_search?_source=true [status:400 request:0.005s]
Failed to query Elasticsearch using '(a)': TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')
Traceback (most recent call last):
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/haystack/backends/elasticsearch_backend.py", line 524, in search
    _source=True)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/client/utils.py", line 71, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/client/__init__.py", line 569, in search
    doc_type, '_search'), params=params, body=body)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/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 "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 124, in perform_request
    self._raise_error(response.status, raw_data)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/connection/base.py", line 122, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')
ERROR elasticsearch_backend Failed to query Elasticsearch using '(a)': TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')
Traceback (most recent call last):
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/haystack/backends/elasticsearch_backend.py", line 524, in search
    _source=True)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/client/utils.py", line 71, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/client/__init__.py", line 569, in search
    doc_type, '_search'), params=params, body=body)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/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 "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 124, in perform_request
    self._raise_error(response.status, raw_data)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/connection/base.py", line 122, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')
WARNING base GET http://127.0.0.1:9200/haystack/modelresult/_search?_source=true [status:400 request:0.003s]
Failed to query Elasticsearch using '(a)': TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')
Traceback (most recent call last):
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/haystack/backends/elasticsearch_backend.py", line 524, in search
    _source=True)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/client/utils.py", line 71, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/client/__init__.py", line 569, in search
    doc_type, '_search'), params=params, body=body)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/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 "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 124, in perform_request
    self._raise_error(response.status, raw_data)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/connection/base.py", line 122, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')
ERROR elasticsearch_backend Failed to query Elasticsearch using '(a)': TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')
Traceback (most recent call last):
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/haystack/backends/elasticsearch_backend.py", line 524, in search
    _source=True)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/client/utils.py", line 71, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/client/__init__.py", line 569, in search
    doc_type, '_search'), params=params, body=body)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/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 "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 124, in perform_request
    self._raise_error(response.status, raw_data)
  File "/home/alamin/.virtualenvs/msnb2/lib/python3.5/site-packages/elasticsearch/connection/base.py", line 122, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')
[29/Oct/2016 10:10:28]"GET /search/?q=a HTTP/1.1" 200 22675

我设置了 elasticsearch 2.3.1 而不是 5,它成功了!我认为答案是:

We don't support 5.0 yet, but I'll try to get ahead of it

来自 github