def METHOD_NAME(*, index, mappings, index_settings=None):
    """Create an index if it's not present.
    Return the index name.
    Options:
    - index: name of the index.
    - mappings and index_settings: if provided, used when passing the
    configuration of the index to ES.
    """
    es = get_es()
    if index_settings is None:
        index_settings = {'index': {}}
    else:
        # Make a deepcopy of the settings that was passed, so that we can
        # modify it freely to add shards and replicas settings.
        index_settings = deepcopy(index_settings)
    index_settings['index'].update(
        {
            'number_of_shards': settings.ES_DEFAULT_NUM_SHARDS,
            'number_of_replicas': settings.ES_DEFAULT_NUM_REPLICAS,
            'max_result_window': settings.ES_MAX_RESULT_WINDOW,
        }
    )
    if not es.indices.exists(index=index):
        es.indices.create(index=index, mappings=mappings, settings=index_settings)
    return index