Java rest client 5.6, fetch if "Type" exists

I am working on migration from Transport client to rest client:
To start with the simple change:
earlier in transport client to find a "type" exists ,we did this:

boolean typexists = this.client.admin().indices().prepareTypesExists("recovery_index").setTypes("recovery_type").get(TimeValue.timeValueSeconds(this.timeoutSecs)).isExists();

how do we achieve this using restClient? In rest Client we can get this as response:

Response response=restClient.performRequest("GET", "/recovery_index/recovery_type/_search", Collections.singletonMap("pretty", "true"));

now further from this response any quicker way to get if type exists??

Types exists can be done through a HEAD request to the /{index}/_mapping/{type} endpoint. It will return no response body, but the returned status code will tell you whether the type exists (200) or not (404).

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.