def fulltext_search_stage(
    query: str,
    search_field: str,
    index_name: str,
    operator: str = "text",
    filter: Optional[Dict[str, Any]] = None,
    limit: int = 10,
    **kwargs: Any,
) -> List[Dict[str, Any]]:
    """
    Full-Text search.

    Args:
        query: Input text to search for
        search_field: Field in Collection that will be searched
        index_name: Atlas Search Index name
        operator: A number of operators are available in the text search stage.

    Returns:
        Dictionary defining the $search

    See Also:
        - MongoDB Full-Text Search <https://www.mongodb.com/docs/atlas/atlas-search/aggregation-stages/search/#mongodb-pipeline-pipe.-search>
        - MongoDB Operators <https://www.mongodb.com/docs/atlas/atlas-search/operators-and-collectors/#std-label-operators-ref>

    """
    pipeline = [
        {
            "$search": {
                "index": index_name,
                operator: {"query": query, "path": search_field},
            }
        },
    ]
    if filter:
        pipeline.append({"$match": filter})
    pipeline.append({"$limit": limit})
    return pipeline

    Full-Text search.

    Args:
        query: Input text to search for
        search_field: Field in Collection that will be searched
        index_name: Atlas Search Index name
        operator: A number of operators are available in the text search stage.

    Returns:
        Dictionary defining the $search

    See Also:
        - MongoDB Full-Text Search <https://www.mongodb.com/docs/atlas/atlas-search/aggregation-stages/search/#mongodb-pipeline-pipe.-search>
        - MongoDB Operators <https://www.mongodb.com/docs/atlas/atlas-search/operators-and-collectors/#std-label-operators-ref>

    
llama-index-integrations/vector_stores/llama-index-vector-stores-mongodb/llama_index/vector_stores/mongodb/pipelines.py