2017-02-17 5 views

答えて

0

NugetパッケージマネージャからElasticSearch.netとNestをインストールする必要があります。両方とも同じバージョンでなければなりません。

Nest Elastic Clientを使用してステータスを確認する方法があります。

public string HealthCheck(WaitForStatus waitForStatus = WaitForStatus.Red, bool logResults = false) 
    { 
      var response = this._client.ClusterHealth(new ClusterHealthRequest() { WaitForStatus = waitForStatus }); 

      var healthColor = response.Status.ToLower(); 

      // this will give you the color code of the elastic search server health. 

      switch (healthColor) 
        { 
         case "green": 
         var message = "ElasticSearch Server health check returned [GREEN]"; 
         break; 

        case "yellow": 
         var message = "ElasticSearch Server health check returned [YELLOW] (yellow is normal for single node clusters) "; 
         break; 

        default: // Includes "red" 
         var message = "ElasticSearch Server health check returned [{0}]".FormatInLine(response.Status.ToUpper()); 
         break; 

       } 

     return message; 
    } 

あなたが取得したメッセージによって、サーバーの正常性を確認できます。 緑色と黄色を使用できますが、赤色の場合は問題が発生することがあります。

ありがとう............

関連する問題