def test_filter_contains(os_stores: List[OpensearchVectorStore], insert_document):
    """
    Test that OpensearchVectorStore correctly applies FilterOperator.CONTAINS in filters. Should only match
    exact substring matches.
    """
    for os_store in os_stores:
        for metadata, id_ in [
            ({"name": "John Doe"}, "match1"),
            ({"name": "Johnny Doe"}, "match2"),
            ({"name": "Jon Doe"}, "nomatch"),
        ]:
            insert_document(os_store, doc_id=id_, metadata=metadata)

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

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

    Test that OpensearchVectorStore correctly applies FilterOperator.CONTAINS in filters. Should only match
    exact substring matches.
    
llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/tests/test_opensearch_client.py