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}