Connection Timeout with Elasticsearch

前端 未结 9 2052
刺人心
刺人心 2020-12-04 21:01
from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()

doc = {
    \'author\': \'kimchy\',
    \'text\': \'Elasticsearch: cool.          


        
9条回答
  •  既然无缘
    2020-12-04 21:05

    elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host='localhost', port=9200): Read timed out. (read timeout=10)) mean the request didn't end in the specified time (by default, timeout=10).

    This will work with 30 seconds :

    res = es.index(index="test-index", doc_type='tweet', id=1, body=doc, timeout=30)

提交回复
热议问题