Ron*_*ora 1 python python-3.x elasticsearch elasticsearch-py
我正在尝试使用 elasticsearch-py 在我的应用程序代码中关闭与我的 elasticsearch 集群的连接。
目前,我正在使用:
es = Elasticsearch()
es.close()
Run Code Online (Sandbox Code Playgroud)
但是,我收到错误:
Traceback (most recent call last):
File "tmp.py", line 45, in <module>
es.close()
AttributeError: 'Elasticsearch' object has no attribute 'close'
Run Code Online (Sandbox Code Playgroud)
我也没有在文档中看到任何关闭方法:
https://elasticsearch-py.readthedocs.io/en/master/api.html
任何帮助将不胜感激!提前致谢 :)
您可以使用以下命令关闭传输Transport.close:
es = Elasticsearch()
es.transport.close()
Run Code Online (Sandbox Code Playgroud)