Hello All,
I'm new to Elasticsearch, while running below python code I'm getting TransportError: TransportError(503, u'search_phase_execution_exception') :-
Python code :-
f = open(file, "rb")
strings = f.read(offset)
strings = binascii.hexlify(strings)
strings = ' '.join(strings[i:i+2] for i in xrange(0,len(strings),2))
strings = strings + " "
string = strings.split(" 00 ")
for stri in string:
if stri != "":
if stri == "00":
continue
temp = stri.replace(" ","") + "00"
occurence = 1
try:
**res = es_client.search( index=index, doc_type=type, body={"query": { "match":{"_id":temp} } })**
if res['hits']['hits']:
for src_dict in res['hits']['hits']:
if src_dict['_source']['occurence']:
occurence = src_dict['_source']['occurence'] + 1
except:
print traceback.print_exc()
json_data = {}
json_data['_index'] = index
json_data['_type'] = type
json_data['_id'] = temp
json_data['_source'] = { 'occurence' : occurence,
'timestamp' : datetime.now()
}
bulk_res_list.append(json_data)
del json_data
try:
if len(bulk_res_list) >= BULK_MAX:
helpers.bulk(es_client, bulk_res_list)
del bulk_res_list[:]
except:
print traceback.print_exc()
try:
if len(bulk_res_list) >= 0:
helpers.bulk(es_client, bulk_res_list)
del bulk_res_list[:]
except:
print traceback.print_exc()
f.close()
I'm getting below exceptions :-
Traceback (most recent call last):
File "updateStringOccurence.py", line 443, in insertFunction
**res = es_client.search( index=index, doc_type=type, body={"query": { "match":{"_id":temp} } })**
File "C:\Python27\lib\site-packages\elasticsearch\client\utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "C:\Python27\lib\site-packages\elasticsearch\client\__init__.py", line 530, in search
doc_type, '_search'), params=params, body=body)
File "C:\Python27\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:\Python27\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 93, in perform_request
self._raise_error(response.status, raw_data)
File "C:\Python27\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)
**TransportError: TransportError(503, u'search_phase_execution_exception')**
Below are the node details :-
O.S :- CentOS release 6.7 (Final)
ES version:- 2.2.2