0
点赞
收藏
分享

微信扫一扫

Python 连接 ES 的 API 用例:获取满足条件的索引列表


文档地址:​​https://elasticsearch-py.readthedocs.io/en/v8.0.1/api.html#cat​​

返回 Json 格式的查询一个索引的通配的样例:

from elasticsearch import Elasticsearch

es_host = "localhost:19200"

es_client = Elasticsearch(es_host)
es_client.cat.indices(index="index_name*", format="json")

返回 Json 格式的查询多个索引的通配的样例:

from elasticsearch import Elasticsearch

es_host = "localhost:19200"

es_client = Elasticsearch(es_host)
es_client.cat.indices(index=["index_name1*", "index_name2*"], format="json")


举报

相关推荐

0 条评论