gpt4 book ai didi

python - Django/Haystack 错误 : elasticsearch. exceptions.RequestError : TransportError(400, 'parsing_exception' ,...)

转载 作者:太空狗 更新时间:2023-10-30 00:05:32 26 4
gpt4 key购买 nike

我在我的 Django 项目中使用 elasticsearch 作为 haystack 的后端。如前所述,我创建了搜索所需的所有内容 here .但是当我搜索时,我抛出了一个回溯错误 TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')。

我已经用谷歌搜索了这个问题。但是没有得到任何解决方案。如果能帮我解决这个问题,我将不胜感激。

我的回溯:

Traceback (most recent call last):
File "c:\python34\lib\site- packages\haystack\backends\elasticsearch_backend.py", line 524, in search
_source=True)
File "c:\python34\lib\site-packages\elasticsearch\client\utils.py", line 71, in _wrapped
return func(*args, params=params, **kwargs)
File "c:\python34\lib\site-packages\elasticsearch\client\__init__.py", line 569, in search
doc_type, '_search'), params=params, body=body)
File "c:\python34\lib\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 "c:\python34\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 124, in perform_request
self._raise_error(response.status, raw_data)
File "c:\python34\lib\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]')
[28/Dec/2016 17:06:58]"GET /search/?q=code HTTP/1.1" 200 395

Update-1 : 降级到elasticsearch==1.7.0后的TraceBack

GET /haystack/modelresult/_search?_source=true [status:400 request:0.001s]
Failed to query Elasticsearch using '(code)': TransportError(400, 'parsing_exception')
Traceback (most recent call last):
File "c:\python34\lib\site-packages\haystack\backends\elasticsearch_backend.py", line 524, in search
_source=True)
File "c:\python34\lib\site-packages\elasticsearch\client\utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "c:\python34\lib\site-packages\elasticsearch\client\__init__.py", line 527, in search
doc_type, '_search'), params=params, body=body)
File "c:\python34\lib\site-packages\elasticsearch\transport.py", line 307, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "c:\python34\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 93, in perform_request
self._raise_error(response.status, raw_data)
File "c:\python34\lib\site-packages\elasticsearch\connection\base.py", line 105, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception')
[28/Dec/2016 17:58:50]"GET /search/?q=code HTTP/1.1" 200 395

最佳答案

no [query] registered for [filtered]

据我所知,您正在运行 ES 5.0,并且您正在发送一个 filtered 查询,该查询已在 ES 2.x 和 removed in ES 5.x 中弃用。 .

您需要将其替换为 bool/filter query相反。

所以如果你有这样的事情:

{
"query": {
"filtered": {
"filter": {}
}
}
}

只需将其替换为

{
"query": {
"bool": {
"filter": {}
}
}
}

关于python - Django/Haystack 错误 : elasticsearch. exceptions.RequestError : TransportError(400, 'parsing_exception' ,...),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41361321/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com