elasticsearch api code call using highlevelrestclient

Solutions on MaxInterview for elasticsearch api code call using highlevelrestclient by the best coders in the world

showing results for - "elasticsearch api code call using highlevelrestclient"
Nolan
15 Feb 2018
1Request request = new Request("GET", "/_cluster/health");
2request.addParameter("wait_for_status", "green"); 
3Response response = client.getLowLevelClient().performRequest(request); 
4
5ClusterHealthStatus healthStatus;
6try (InputStream is = response.getEntity().getContent()) { 
7    Map<String, Object> map = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true); 
8    healthStatus = ClusterHealthStatus.fromStringString) map.get("status"; 
9}
10
11if (healthStatus != ClusterHealthStatus.GREEN) {
12    
13}