【问题标题】:how to fix request time out while indexing a dictionary如何在索引字典时修复请求超时
【发布时间】:2019-08-28 08:17:32
【问题描述】:

我正在尝试以弹性方式索引我的数据,但出现超时错误。

所以我尝试更改端口并尝试增加超时。我也尝试将数据转换为 json。

data 是一个 python 字典:


from elasticsearch import Elasticsearch

es = Elasticsearch([{'host': 'localhost', 'port': 9200}])


def index_profile(data):
    es.index(index='prof', id=data["id"], doc_type='people', body=data, request_timeout=30)


这是我的弹性配置文件的网络和发现部分:

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: localhost
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["localhost", "[::1]"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#


最后我得到了这个错误: elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout 由 - ReadTimeoutError(HTTPConnectionPool(host='localhost', port=9200): 读取超时。(读取超时=30)) 这是在弹性日志中: 该节点之前没有加入过引导

【问题讨论】:

    标签: python elasticsearch


    【解决方案1】:

    如果它可以帮助我发现我需要将此行添加到我的 .yml 文件中的任何人

    cluster.initial_master_nodes: ["node-1"]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-18
      • 2011-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-17
      • 2016-04-26
      相关资源
      最近更新 更多