Elasticsearch Python client Reindex Timedout
Question: I'm trying to reindex using the Elasticsearch python client, using
<https://elasticsearch-
py.readthedocs.org/en/master/helpers.html#elasticsearch.helpers.reindex>. But
I keep getting the following exception:
`elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by -
ReadTimeout`

The stacktrace of the error is

    
    
    Traceback (most recent call last):
      File "~/es_test.py", line 33, in <module>
        main()
      File "~/es_test.py", line 30, in main
        target_index='users-2')
      File "~/ENV/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 306, in reindex
        chunk_size=chunk_size, **kwargs)
      File "~/ENV/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 182, in bulk
        for ok, item in streaming_bulk(client, actions, **kwargs):
      File "~/ENV/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 124, in streaming_bulk
        raise e
    elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ReadTimeout(HTTPSConnectionPool(host='myhost', port=9243): Read timed out. (read timeout=10))
    

Is there anyway to prevent this exception besides increasing the timeout?

**EDIT:** python code

    
    
    from elasticsearch import Elasticsearch, RequestsHttpConnection, helpers
    
    es = Elasticsearch(connection_class=RequestsHttpConnection,
                       host='myhost',
                       port=9243,
                       http_auth=HTTPBasicAuth(username, password),
                       use_ssl=True,
                       verify_certs=True,
                       timeout=600)
    helpers.reindex(es, source_index=old_index, target_index=new_index)
    


Answer: It may be happening because of the OutOfMemoryError for Java heap space, which
means you are not giving elasticsearch enough memory for what you want to do.
Try to look at your `/var/log/elasticsearch` if there is any exception like
that.

<https://github.com/elastic/elasticsearch/issues/2636>

