Deleting Index causes Timeout value connect was 600, but it must be an int, float or None

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

opensearch-py 2.2.0

Describe the issue:
After upgrading from opensearch-py 2.0.0 to 2.2.0 I have been facing the following issue when trying to perform the delete index operation and setting the timeout value through the client I get a connection error

client.indices.delete(index=index, ignore=[400, 404], timeout=600)

opensearchpy.exceptions.ConnectionError: ConnectionError(Timeout value connect was 600, but it must be an int, float or None.) caused by: ValueError(Timeout value connect was 600, but it must be an int, float or None.)

The version of requests library is 2.28.1

Screenshot

Hi, thanks for bringing this to our attention. You have to use timeout inside of a params object like mentioned here – [BUG] Timeout parameter doesn't work when calling client.indices.delete() · Issue #260 · opensearch-project/opensearch-py · GitHub

2 Likes

Here, params is a “dictionary” of query parameters. So, the following implementation will work.

client.indices.delete(
index = index_name, params={“timeout”:120}
)

1 Like

Is this a breaking change from 2.0.0 to 2.2.0?

Yes, It didn’t create an issue in version 2.0.0

Thank you! That worked!!

@wbeckler, No it is not a breaking change.

@vasiachr, I tried the below code in opensearch-py 2.0.0. It is giving illegal_argument_exception. So, I don’t think this is a breaking change from 2.0.0 to 2.2.0.

client.indices.delete(index=index_name, timeout=600).

So, please use

client.indices.delete(index = index_name, params={“timeout”:120})

Thanks :slightly_smiling_face:

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.