如何在python上在AWS OpenSearch库上指定超时

发布于 2025-02-05 09:37:32 字数 623 浏览 1 评论 0原文

我正在使用 https://opensearch.org/docs/latest/latest/clients/clients/python/ 要与OpenSearch实例进行交互,

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

但我需要以某种方式可以轻松地延长请求的寿命。我搜索了文档,但找不到timeout参数。

有没有办法指定超时?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌伤浅笑 2025-02-12 09:37:33

创建它时,您可以将timeout = 60(或其他)传递给OpenSearch对象。这将传递到下划线连接对象。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文