Skip to content
Advertisement

How to specify timeout on aws opensearch library for python

I am using https://opensearch.org/docs/latest/clients/python/ to interact with an opensearch instance

client = OpenSearch(
            hosts=[{'host': host, 'port': port}],
            http_auth=auth,
            use_ssl=True,
            verify_certs=True,
            connection_class=RequestsHttpConnection,
         ---->   request_timeout=100000 <-----
        )

but I need somehow to to extend the lifetime of the request easily. I searched the docs and I couldn’t find a timeout parameter.

Is there a way to specify a timeout?

Advertisement

Answer

You can pass timeout=60 (or whatever) to the OpenSearch object when you create it. This gets passed to the underline connection object.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement