private void addMappingToIndex(
            final String index, final String mappingType, final String mappingFilename)
            throws IOException {

        LOGGER.info("Adding '{}' mapping to index '{}'...", mappingType, index);

        String resourcePath = "/" + index + "/_mapping/" + mappingType;

        if (doesResourceNotExist(resourcePath)) {
            HttpEntity entity =
                    new NByteArrayEntity(
                            loadTypeMappingSource(mappingFilename).getBytes(),
                            ContentType.APPLICATION_JSON);
            elasticSearchAdminClient.performRequest(
                    HttpMethod.PUT, resourcePath, Collections.emptyMap(), entity);
            LOGGER.info("Added '{}' mapping", mappingType);
        } else {
            LOGGER.info("Mapping '{}' already exists", mappingType);
        }
    }
Adds a mapping type to an index if it does not exist.

@param index The name of the index.
@param mappingType The name of the mapping type.
@param mappingFilename The name of the mapping file to use to add the mapping if it does not
    exist.
@throws IOException If an error occurred during requests to ES.
es6-persistence/src/main/java/com/netflix/conductor/es6/dao/index/ElasticSearchRestDAOV6.java