Elasticsearch的连接超时
from datetime import datetime from elasticsearch import Elasticsearch es = Elasticsearch() doc = { 'author': 'kimchy', 'text': 'Elasticsearch: cool. bonsai cool.', 'timestamp': datetime(2010, 10, 10, 10, 10, 10) } res = es.index(index="test-index", doc_type='tweet', id=1, body=doc) print(res['created']) 这个简单的代码返回以下错误: elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host='localhost', port=9200): Read timed out. (read timeout=10)) 非常奇怪,因为服务器已准备就绪并已设置(http:// …