Java prepareGetTemplates Exists call?

Is there a simple way to see if template exists in Java?

client.admin().indices().prepareGetTemplates(TEMPLATE_NAME).get()

Was thinking more of a prepareExistsTemplates() to do something like HEAD call

This is how I implemented it so far:

public static boolean isTemplateExist(Client client, String template) {
    return !client.admin().indices().prepareGetTemplates(template).get().getIndexTemplates().isEmpty();
}

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