def get_indices()

in curator/helpers/getters.py [0:0]


def get_indices(client, search_pattern='*', include_hidden=False):
    """
    Calls :py:meth:`~.elasticsearch.client.CatClient.indices`

    Will use the provided ``search_pattern`` to get a list of indices from the
    cluster. If ``include_hidden`` is ``True``, it will include hidden indices
    in 'expand_wildcards'.

    :param
        client: A client connection object
        search_pattern: The index search pattern to use
        include_hidden: Include hidden indices in the list
    :type
        client: :py:class:`~.elasticsearch.Elasticsearch`
        search_pattern: str
        include_hidden: bool


    :returns: The matching list of indices from the cluster
    :rtype: list
    """
    logger = logging.getLogger(__name__)
    indices = []
    expand = 'open,closed,hidden' if include_hidden else 'open,closed'
    logger.debug('expand = %s', expand)
    try:
        # Doing this in two stages because IndexList also calls for these args,
        # and the unit tests need to Mock this call the same exact way.
        resp = client.cat.indices(
            index=search_pattern + ',' + EXCLUDE_SYSTEM,
            expand_wildcards=expand,
            h='index,status',
            format='json',
        )
    except Exception as err:
        raise FailedExecution(f'Failed to get indices. Error: {err}') from err
    if not resp:
        return indices
    for entry in resp:
        indices.append(entry['index'])
    logger.debug('All indices: %s', indices)
    return indices