我已经编写了将 json 导入到 elasticsearch 的代码,但我的连接错误为'Connection aborted.',error(104, 'Connection reset by peer'
代码是
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)
错误是
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'))
谁能帮我吗 ?