我正在尝试使用elasticsearch-py在我的应用程序代码中关闭到我的Elasticsearch集群的连接。
目前,我正在使用:
es = Elasticsearch()
es.close()
但是,我得到了错误:
Traceback (most recent call last):
File "tmp.py", line 45, in <module>
es.close()
AttributeError: 'Elasticsearch' object has no attribute 'close'
我也没有在文档中看到任何关闭方法:
https://elasticsearch-py.readthedocs.io/en/master/api.html
任何帮助将不胜感激!提前致谢 :)
最佳答案
您可以使用 Transport.close
关闭传输:
es = Elasticsearch()
es.transport.close()
关于python - 使用elasticsearch-py关闭与Elasticsearch集群的连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56417803/