I am converting a codebase that previously used the java TransportClient on an elastic 1.6.2 cluster to use the high level REST http java library. I want to make a request to the ClusterState API described for http here: https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html
There is no corresponding page to the java library
A section of my code retrieves a ClusterStateResponse
like this:
ClusterStateResponse state = client.admin().cluster().prepareState().execute().actionGet();
For version 7.3.2 of org.elasticsearch.client.RestHighLevelClient
for the Java Elasticsearch library:
Is it possible to use the RestHighLevelClient
to execute a ClusterStateRequest
?
In case of the unavailability of required Request you can always fall back to low level rest client. So in order to get the cluster state you can call the api as below,
Request request = new Request("GET", "/_cluster/state");
Response response = restHighlevelClient.getLowLevelClient().performRequest(request);