Use elasticsearch-py client to search, and get index_not_found_exception error, why?

i use elasticsearch-py client to do search, but get the follow error:

Traceback (most recent call last):
File "./", line 203, in
File "./", line 185, in main
search_index_and_dump(each_index, direction, topn, who)
File "./", line 137, in search_index_and_dump
(sum_bytes, buckets_dict) = search_unit(each_index, direction, topn, who, prefer)
File "./", line 41, in search_unit
result =
File "/root/.jumbo/lib/python2.7/site-packages/elasticsearch/client/", line 71, in _wrapped
return func(*args, params=params, **kwargs)
File "/root/.jumbo/lib/python2.7/site-packages/elasticsearch/client/", line 569, in search
doc_type, '_search'), params=params, body=body)
File "/root/.jumbo/lib/python2.7/site-packages/elasticsearch/", line 327, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "/root/.jumbo/lib/python2.7/site-packages/elasticsearch/connection/", line 124, in perform_request
self._raise_error(response.status, raw_data)
File "/root/.jumbo/lib/python2.7/site-packages/elasticsearch/connection/", line 122, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.NotFoundError: TransportError(404, u'index_not_found_exception', u'no such index')

the python code :
search_parameters = {}
search_parameters['index'] = 'netflow_log-2016.12.01'
search_parameters['body'] = get_query_string(direction, topn, who)
search_parameters['_source'] = False
search_parameters['preference'] = prefer
search_parameters['search_type'] = 'query_then_fetch'
search_parameters['size'] = 0

es = Elasticsearch(['localhost:8200'])
result =

I am sure the elasticsearch has the index 'netflow_log-2016.12.01', and
the get_query_string(direction, topn, who) funtion is correct also.

Can somebody tell me what wrong is there?
thanks very much!

en, i have corrected the error.

this code line should be modified from
result =
result =**search_parameters)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.