code: private static void createTypeWithMappingInElasticsearch(RestHighLevelClient client, String index, String mapping)
              throws Exception {
          logger.trace("createTypeWithMappingInElasticsearch([{}])", index);
  
          assert client != null;
          assert index != null;
  
          if (mapping != null) {
              // Create mapping
              client.indices().putMapping(new PutMappingRequest(index).source(mapping, XContentType.JSON), RequestOptions.DEFAULT);
          } else {
              logger.trace("no content given for mapping. Ignoring mapping creation in index [{}].", index);
          }
  
          logger.trace("/createTypeWithMappingInElasticsearch([{}])", index);
      }
docs: Create a new type in Elasticsearch
  @param client Elasticsearch client
  @param index Index name
  @param mapping Mapping if any, null if no specific mapping
  @throws Exception if the elasticsearch call is failing