首先,确保你已经安装了elasticsearch库。如果没有安装,可以使用pip进行安装:
pip install elasticsearch
如下:

输入 python 进入交互模式。然后依次输入一下命令。
- from elasticsearch import Elasticsearch
- es = Elasticsearch(['10.101.xxx.xxx'], http_auth=('elastic', 'xxxxx'), timeout=3600)
- health = es.cluster.health()
- print(health)
可以看到能输出对应结果:

没啥可说的。ps:注意版本兼容。
链接腾讯云es就看下腾讯云的手册: Elasticsearch Service 通过客户端访问集群-快速入门-文档中心-腾讯云
其他问题就看看官方的手册: