DataSays / wES

wES is set of open source Java ElasticSearch client and toolkits; Compact, yet highly customizable and powerful.
https://github.com/DataSays/wES
MIT License
27 stars 11 forks source link

How can I get cluster health in wES? #4

Open pokev25 opened 7 years ago

pokev25 commented 7 years ago

In JestClient

Health health = new Health.Builder().build();
JestResult result = client.execute(health);

In RestClient

Response response = client.performRequest("GET", "_cluster/health",
                Collections.singletonMap("pretty", "true"));

How do I do it at wES?

pokev25 commented 7 years ago

I found the answer in EsHelper.

public class EsService extends EsBaseService {
    public Object clusterHealth() throws HttpException {
        ClusterHealth health = esHelper.clusterHealth(null);
        return esHelper.get(health,Object.class);
    }
}

String serverUrl = "http://127.0.0.1:9200/";
helper = new EsService();
helper.init(serverUrl, null, null);
System.out.println(helper.clusterHealth().toString());