嘿~ 今天天气不错嘛

python连接elasticsearch

Elasticsearch | 作者 zkz123 | 发布于2021年01月04日 | 阅读数:3566

代码如下:
from elasticsearch import Elasticsearch
es = Elasticsearch() # 默认连接本地elasticsearch
print(es.index(index='py2', doc_type='doc', id=1, body={'name': "张开", "age": 18}))
print(es.get(index='py2', doc_type='doc', id=1))

报错信息如下:
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f119463f1d0>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f119463f1d0>: Failed to establish a new connection: [Errno 111] Connection refused)
从昨晚一开始使用就是这样,实在不知道怎么办,是也要先启动吗?求助各位了
已邀请:

要回复问题请先登录注册