我尝试使用elasticsearch-py版本2.1.0进行以下聚合查询来查询版本2.1.1的弹性搜索实例。
{
"query": {
"filtered": {
"filter": { "term": {"applicationType":"myapptype"} }
}
},
"aggs":{ "client_id": { "terms": { "field": "client_id" } } }
}
它提供了一个例外说明:
Traceback (most recent call last):
File "searchES2.py", line 52, in <module>
for item in res:
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/helpers/__init__.py", line 271, in scan
resp = client.search(body=query, scroll=scroll, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 530, in search
doc_type, '_search'), params=params, body=body)
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 307, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py", line 93, in perform_request
self._raise_error(response.status, raw_data)
File "/usr/local/lib/python2.7/dist-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, u'search_phase_execution_exception')
如何解决这个问题?
注意:当我使用cURL时,相同的查询工作正常。