python - Elasticsearch python 客户端 : Getting the ES version through API call

标签 python elasticsearch

我想通过python API获取当前的Elasticsearch版本。 我可以通过像

这样的 http 调用轻松获得它
import requests
requests.get(http://endpoint:9200)

但我想知道是否有任何方法可以通过 API 调用而不是对端点的 http 请求来获取版本。喜欢

from elasticsearch import Elasticsearch
es = Elasticsearch()

我浏览了 Elasticsearch python 客户端文档,但找不到可以获取当前 ES 版本 ( https://elasticsearch-py.readthedocs.org/en/master/api.html ) 的调用

最佳答案

您可以使用 info 实现此目的命令:

例子:

from elasticsearch import Elasticsearch
es = Elasticsearch()
es.info()

关于python - Elasticsearch python 客户端 : Getting the ES version through API call,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30791431/

相关文章:

python - Gmail Python 多个附件

python - XLWings/Excel 处理问题 "multi-cell array formulas"

python - 如何使用 Python NetworkX 在有向图中找到最长的 10 条路径?

elasticsearch - 如何在NEST 2.3.0中将 bool 查询与must子句和filter子句一起使用

arrays - Elasticsearch文档映射类型与存储类型不同

elasticsearch - 为什么我的查询忽略了过滤器聚合?

python - 在 Selenium Python3 中切换到第二个 iframe

python - 找到 2D 中最小重叠共享表面

hadoop - 无法以不同用户身份安装 Elasticsearch

elasticsearch - 'exists'可以用来检测ElasticSearch中的空字符串吗?