code: private static void createTemplateWithJsonInElasticsearch(RestClient client, String template, String json) throws Exception {
  		logger.trace("createTemplate([{}])", template);
  
  		assert client != null;
  		assert template != null;
  
  		Request request = new Request("PUT", "/_template/" + template);
  		request.setJsonEntity(json);
  		Response response = client.performRequest(request);
  
  		if (response.getStatusLine().getStatusCode() != 200) {
  			logger.warn("Could not create template [{}]", template);
  			throw new Exception("Could not create template ["+template+"].");
  		}
  
  		logger.trace("/createTemplate([{}])", template);
  	}
docs: Create a new index in Elasticsearch
  @param client Elasticsearch client
  @param template Template name
  @param json JSon content for the template
  @throws Exception if something goes wrong