python链接elaticsearch报错Connection reset by peer
信息如下:
elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))) caused by: ProtocolError(('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))
一下是代码信息:
query = {'query': {'match_all': {}}}
index = 'user_efficiency_detail_page_{}'.format(today.date())
try:
all_doc = client.search(index=index, body=query)
es_data = all_doc['hits']['hits']
if not es_data:
raise ValueError('无数据!')
result = es_data[0]['_source']['result']
except Exception:
result = self.users_efficiency_data_compute()
create_es = {'result': result}
client.index(index=index, doc_type='_doc', body=create_es)
报错之后部署在docker中的es就会直接宕机,不知道为什么。求解。万分感谢。