Connection Timeout with Elasticsearch

前端 未结 9 2056
刺人心
刺人心 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:13

    By default, the timeout value is set to 10 secs. If one wants to change the global timeout value, this can be achieved by setting the flag timeout=your-time while creating the object.

    If you have already created the object without specifying the timeout value, then you can set the timeout value for particular request by using request_timeout=your-time flag in the query.

    es.search(index="my_index",
              doc_type="document",
              body=get_req_body(),
              request_timeout=30)
    

提交回复
热议问题