Skip to content Skip to sidebar Skip to footer

Elasticsearch Python Client - Work With Many Nodes - How To Work With Sniffer

i have one cluster with 2 nodes. i am trying to understand the best practise to connect the nodes, and check failover when there is downtime on one node. from documentation: es =

Solution 1:

You need to set sniff_timeout to a higher value than the default value (which is 0.1 if memory serves).

Try it like this

es = Elasticsearch(
    ['esnode1', 'esnode2'],
    # sniff before doing anything
    sniff_on_start=True,
    # refresh nodes after a node fails to respond
    sniff_on_connection_fail=True,
    # and also every 60 seconds
    sniffer_timeout=60,
    # set sniffing request timeout to 10 seconds
    sniff_timeout=10
)

Post a Comment for "Elasticsearch Python Client - Work With Many Nodes - How To Work With Sniffer"