-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Hello, I am running very simple searches against ElasticSearch (from Ipython notebook) and I get mixed results.
Any help is greatly appreciated.
Here are some code snippets that I am using
This one works:
from elasticsearch import Elasticsearch
es = Elasticsearch('https:/........)
res = es.search(index = '', doc_type = "Devices')
print res['hits']['total']
This one doesn't work (I tried limiting the number of docs with matches thinking it maybe too many docs but same error)
from elasticsearch import Elasticsearch
es = Elasticsearch('https:/........)
res = es.search(index = '',body={"query": {"match_all": {}}})
When I run the above I get a Transport Error 400:
/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.pyc in _wrapped(_args, *_kwargs)
67 if p in kwargs:
68 params[p] = kwargs.pop(p)
---> 69 return func(_args, params=params, *_kwargs)
70 return _wrapped
71 return _wrapper
/usr/local/lib/python2.7/dist-packages/elasticsearch/client/init.pyc in search(self, index, doc_type, body, params)
525 index = '_all'
526 _, data = self.transport.perform_request('GET', _make_path(index,
--> 527 doc_type, '_search'), params=params, body=body)
528 return data
529
/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.pyc in perform_request(self, method, url, params, body)
305
306 try:
--> 307 status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
308
309 except TransportError as e:
/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.pyc in perform_request(self, method, url, params, body, timeout, ignore)
91 if not (200 <= response.status < 300) and response.status not in ignore:
92 self.log_request_fail(method, url, body, duration, response.status)
---> 93 self._raise_error(response.status, raw_data)
94
95 self.log_request_success(method, full_url, url, body, response.status,
/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/base.pyc in _raise_error(self, status_code, raw_data)
103 pass
104
--> 105 raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
106
107
RequestError: TransportError(400, u'')