We are trying to query from ElasticSearchDB the pseudo code is as shown below.
public String searchMovieRelease(){
String movieRelease=null;
WebTarget webTarget = target.path("_search/template"); (1)
Invocation.Builder builder = getInvokationBuilder(target); (2)
movieRelease = builder.post(Entity.json(query)); (3)
return movieRelease;
}
Now, how do, I achieve the same using RestHighLevelClient.
You can do this way:
var client = new RestHighLevelClient(RestClient.builder(HttpHost.create("host"))
.setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(60000).setSocketTimeout(60000)));
var lowClient = client.getLowLevelClient();
var request = new Request("GET", "endpoint");
var response = lowClient.performRequest(request);