(index_name, data_store, timeline_id)
Helper function to close an index if it is not used somewhere else.

    Args:
        index_name: String with the OpenSearch index name.
        data_store: Instance of opensearch.OpenSearchDataStore.
        timeline_id: ID of the timeline the index belongs to.
Helper function to close an index if it is not used somewhere else.
Helper function to close an index if it is not used somewhere else .
def _close_index(index_name, data_store, timeline_id):
    """Helper function to close an index if it is not used somewhere else.

    Args:
        index_name: String with the OpenSearch index name.
        data_store: Instance of opensearch.OpenSearchDataStore.
        timeline_id: ID of the timeline the index belongs to.
    """
    indices = SearchIndex.query.filter_by(index_name=index_name).all()
    for index in indices:
        for timeline in index.timelines:
            if timeline.get_status.status in ('closed', 'deleted', 'archived'):
                continue

            if timeline.id != timeline_id:
                return

    try:
        data_store.client.indices.close(index=index_name)
    except NotFoundError:
        logger.error(
            'Unable to close index: {0:s} - index not '
            'found'.format(index_name))
def _close_index ( index_name , data_store , timeline_id ) : indices = SearchIndex . query . filter_by ( index_name = index_name ) . all ( ) for index in indices : for timeline in index . timelines : if timeline . get_status . status in ( 'closed' , 'deleted' , 'archived' ) : continue if timeline . id != timeline_id : return try : data_store . client . indices . close ( index = index_name ) except NotFoundError : logger . error ( 'Unable to close index: {0:s} - index not ' 'found' . format ( index_name ) )