def test_filter_text_match(
    os_stores: List[OpensearchVectorStore],
    insert_document,
):
    """
    Test that OpensearchVectorStore correctly applies FilterOperator.TEXT_MATCH in filters. Also tests that
    fuzzy matching works as intended.
    """
    for os_store in os_stores:
        for metadata, id_ in [
            ({"name": "John Doe"}, "match1"),
            ({"name": "Doe John Johnson"}, "match2"),
            ({"name": "Johnny Doe"}, "match3"),
            ({"name": "Mary Sue"}, "nomatch"),
        ]:
            insert_document(os_store, doc_id=id_, metadata=metadata)

        query = _get_sample_vector_store_query(
            filters=MetadataFilters(
                filters=[
                    MetadataFilter(
                        key="name", value="John Doe", operator=FilterOperator.TEXT_MATCH
                    )
                ]
            )
        )
        query_result = os_store.query(query)

        doc_ids = {node.id_ for node in query_result.nodes}
        assert doc_ids == {"match1", "match2", "match3"}

    Test that OpensearchVectorStore correctly applies FilterOperator.TEXT_MATCH in filters. Also tests that
    fuzzy matching works as intended.
    
llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/tests/test_opensearch_client.py