code: private void initIndexTemplate(String type) {
          String template = "template_" + type;
          try {
              if (doesResourceNotExist("/_template/" + template)) {
                  logger.info("Creating the index template '" + template + "'");
                  InputStream stream = ElasticSearchDAOV6.class.getResourceAsStream("/" + template + ".json");
                  byte[] templateSource = IOUtils.toByteArray(stream);
  
                  HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON);
                  elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/" + template, Collections.emptyMap(), entity);
              }
          } catch (Exception e) {
              logger.error("Failed to init " + template, e);
          }
      }
docs: Initializes the index with the required templates and mappings.