I have written the code to import json to elasticsearch, but I have got Connection Error as 'Connection aborted.', error(104, 'Connection reset by peer'
The code is
from pyelasticsearch import ElasticSearch
import sys, json
ES_CLUSTER = 'http://localhost:9200/'
ES_INDEX = 'test'
ES_TYPE = 'doc'
es = ElasticSearch(ES_CLUSTER)
json_docs = []
with open(r'sample_data.json') as open_file:
data = json.load(open_file)
for js in data:
json_docs.append(js)
es.bulk(ES_INDEX, ES_TYPE, json_docs)
The error is
Traceback (most recent call last):
File "el_ex.py", line 18, in <module>
es.bulk(ES_INDEX, ES_TYPE, json_docs)
File "/home/tradevigil123/.local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 93, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/home/tradevigil123/.local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 448, in bulk
query_params=query_params)
File "/home/tradevigil123/.local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 281, in send_request
raise exc.info
urllib3.exceptions.ProtocolError: ('Connection aborted.', error(104, 'Connection reset by peer'))
Can, anyone help me out ?