def test_filter_eq(
    os_stores: List[OpensearchVectorStore],
    insert_document,
    operator: FilterOperator,
    key: str,
    value,
    false_value,
):
    """Test that OpensearchVectorStore correctly applies FilterOperator.EQ/NE in filters."""
    for os_store in os_stores:
        for meta, id_ in [
            ({key: value}, "match"),
            ({key: false_value}, "nomatch1"),
            ({}, "nomatch2"),
        ]:
            insert_document(os_store, doc_id=id_, metadata=meta)

        query = _get_sample_vector_store_query(
            filters=MetadataFilters(
                filters=[MetadataFilter(key=key, value=value, operator=operator)]
            )
        )
        query_result = os_store.query(query)

        doc_ids = {node.id_ for node in query_result.nodes}
        if operator == FilterOperator.EQ:
            assert doc_ids == {"match"}
        else:  # FilterOperator.NE
            assert doc_ids == {"nomatch1", "nomatch2"}
Test that OpensearchVectorStore correctly applies FilterOperator.EQ/NE in filters.
llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/tests/test_opensearch_client.py