Просмотр исходного кода

organize elasticsearch delegator

Yuki Takei 6 лет назад
Родитель
Сommit
7b39381bf2
1 измененных файлов с 16 добавлено и 1 удалено
  1. 16 1
      src/server/service/search-delegator/elasticsearch.js

+ 16 - 1
src/server/service/search-delegator/elasticsearch.js

@@ -97,6 +97,13 @@ class ElasticsearchDelegator {
     return this.normalizeIndices();
   }
 
+  /**
+   * return Nodes Info
+   * `cluster:monitor/nodes/info` privilege is required on ES
+   * @return {object} `{ esVersion, esNodeInfos }`
+   *
+   * @see https://www.elastic.co/guide/en/elasticsearch/reference/6.6/cluster-nodes-info.html
+   */
   async getInfo() {
     const info = await this.client.nodes.info();
     if (!info._nodes || !info.nodes) {
@@ -126,8 +133,16 @@ class ElasticsearchDelegator {
     return { esVersion, esNodeInfos };
   }
 
+  /**
+   * return Cluster Health
+   * `cluster:monitor/health` privilege is required on ES
+   * @return {object} `{ esClusterHealth }`
+   *
+   * @see https://www.elastic.co/guide/en/elasticsearch/reference/6.6/cluster-health.html
+   */
   async getInfoForHealth() {
-    return this.client.cluster.health();
+    const esClusterHealth = await this.client.cluster.health();
+    return { esClusterHealth };
   }
 
   /**