code: public static void createTemplateWithJson(RestClient client, String template, String json, boolean force) throws Exception {
  		if (isTemplateExist(client, template)) {
  			if (force) {
  				logger.debug("Template [{}] already exists. Force is set. Removing it.", template);
  				removeTemplate(client, template);
  			} else {
  				logger.debug("Template [{}] already exists.", template);
  			}
  		}
  
  		if (!isTemplateExist(client, template)) {
  			logger.debug("Template [{}] doesn't exist. Creating it.", template);
  			createTemplateWithJsonInElasticsearch(client, template, json);
  		}
  	}
docs: Create a new template in Elasticsearch
  @param client Elasticsearch client
  @param template Template name
  @param json JSon content for the template
  @param force set it to true if you want to force cleaning template before adding it
  @throws Exception if something goes wrong