如何在单个 API 调用中使用不同指标检查 elasticsearch 健康状况?

How to check elasticksearch health with different metrics in single API call?

我需要阅读以下 elasticksearch 指标

  1. 版本
  2. 正常运行时间
  3. 没有。职位
  4. 整体健康
  5. 没有。节点数
  6. 磁盘可用百分比
  7. JVM 堆大小
  8. 没有。指数
  9. 主要碎片
  10. 副本碎片

在 ASP.Net MVC 应用程序中。我的问题 :- 是否可以在 elasticsearch 中通过一次 API 调用来读取上述所有指标?

我写了下面的方法

private static string CheckESHealth()
    {
        string esurl = "http://localhost:9200/_cluster/health";
        HttpClient httpClient = new HttpClient();
        string strReturnVal = string.Empty;
        try
        {
            var response = httpClient.GetAsync(new Uri(esurl)).Result;
            if (response.IsSuccessStatusCode)
            {
                var esdata = response.Content.ReadAsStringAsync().Result;

                if (!string.IsNullOrEmpty(esdata))
                {
                    JObject jobject = JObject.Parse(esdata);
        //as a example i have taken only status.. but i need all paramters mention above
                    strReturnVal = jobject["status"].ToString();
                }
            }
            else
            {
                strReturnVal = "Errored : Received status code : " + response.StatusCode;
            }
        }
        catch (Exception ex)
        {
            strReturnVal = "Errored : " + ex.Message;
        }

        return strReturnVal;
    }

在上面的示例中,我使用的是:- GET _cluster/health 命令,它给出以下结果

enter image description here

但我试图在一次 API 调用中读取上述所有指标

我没有找到一种方法来阅读上面[有问题]在一个查询中提到的指标。所以,我使用以下查询来获取指标。

  1. http://localhost:9200/_cat/health?h=cluster,status,node.total,shards,pri,relo&format=json
  2. http://localhost:9200/_cat/nodes?h=version,uptime,heap.percent&format=json
  3. http://localhost:9200/_cat/allocation?h=disk.percent&format=json