Hi, looking for a way to set a fail-fast timeout on connections to OpenSearch. I’ve tried setting timeout=5 from the client instantiation, but i’m still seeing 10 second exceptions, as set in
https://github.com/opensearch-project/opensearch-py/blob/main/opensearchpy/connection/base.py
from opensearchpy import OpenSearch
opensearch_client = OpenSearch(
...
timeout = 5
)
It’s been two weeks with no input , so what i’ve done is a quick requests connection test before opening opensearch to see about basic reachability. In this way i can fast-fail for not reachable, and still maintain a long timeout for search queries that take longer.
Way late but the way to do it is described here: https://stackoverflow.com/a/77191094/4021308
search(
index=index,
body=search_body,
params={
"timeout":30,
"scroll": scroll,
"ignore": ignore,
"size": size
}
)
basically you need to add it to the params per request