elasticsearchtimeoutconnection-timeouttimeoutexceptionexecutiontimeout

How to Fix Read timed out in Elasticsearch


I used Elasticsearch-1.1.0 to index tweets. The indexing process is okay. Then I upgraded the version. Now I use Elasticsearch-1.3.2, and I get this message randomly:

Exception happened: Error raised when there was an exception while talking to ES.
ConnectionError(HTTPConnectionPool(host='127.0.0.1', port=8001): Read timed out. (read timeout=10)) caused by: ReadTimeoutError(HTTPConnectionPool(host='127.0.0.1', port=8001): Read timed out. (read timeout=10)).

Snapshot of the randomness:

Happened --33s-- Happened --27s-- Happened --22s-- Happened --10s-- Happened --39s-- Happened --25s-- Happened --36s-- Happened --38s-- Happened --19s-- Happened --09s-- Happened --33s-- Happened --16s-- Happened 

--XXs-- = after XX seconds

Can someone point out on how to fix the Read timed out problem?

Thank you very much.


Solution

  • Its hard to give a direct answer since the error your seeing might be associated with the client you are using. However a solution might be one of the following:

    1.Increase the default timeout Globally when you create the ES client by passing the timeout parameter. Example in Python

    es = Elasticsearch(timeout=30)
    

    2.Set the timeout per request made by the client. Taken from Elasticsearch Python docs below.

    # only wait for 1 second, regardless of the client's default
    es.cluster.health(wait_for_status='yellow', request_timeout=1)
    

    The above will give the cluster some extra time to respond