def vector_indexed(collection: Collection) -> str:
    """
    This creates a vector search index
    with a filter on the year field within the metadata document.

    To be able to filter on another field, said field must be indexed.
    That is done in `year_indexed` fixture. It is not a vector search type.

    Note naming: `metadata.naming`, MQL for accessing nested documents.
    """
    if not any(
        idx["name"] == VECTOR_INDEX_NAME for idx in collection.list_search_indexes()
    ):
        index.create_vector_search_index(
            collection=collection,
            index_name=VECTOR_INDEX_NAME,
            dimensions=DIMENSIONS,
            path="embedding",
            similarity="cosine",
            filters=["metadata.year"],
            wait_until_complete=TIMEOUT,
        )
    return VECTOR_INDEX_NAME

    This creates a vector search index
    with a filter on the year field within the metadata document.

    To be able to filter on another field, said field must be indexed.
    That is done in `year_indexed` fixture. It is not a vector search type.

    Note naming: `metadata.naming`, MQL for accessing nested documents.
    
llama-index-integrations/vector_stores/llama-index-vector-stores-mongodb/tests/test_filters.py