def test_filter_range_datetime(
    os_stores: List[OpensearchVectorStore],
    insert_document,
    operator: FilterOperator,
    exp_doc_ids: set,
):
    """Test that OpensearchVectorStore correctly applies FilterOperator.GT/GTE/LT/LTE in filters for datetime."""
    for os_store in os_stores:
        dt = datetime.now()
        for i in range(1, 5):
            insert_document(
                os_store,
                doc_id=f"date{i}",
                metadata={"created_at": dt.replace(second=i).isoformat()},
            )
        insert_document(os_store, doc_id="nomatch", metadata={})

        query = _get_sample_vector_store_query(
            filters=MetadataFilters(
                filters=[
                    MetadataFilter(
                        key="created_at",
                        value=dt.replace(second=2).isoformat(),
                        operator=operator,
                    )
                ]
            )
        )
        query_result = os_store.query(query)

        doc_ids = {node.id_ for node in query_result.nodes}
        assert doc_ids == exp_doc_ids
Test that OpensearchVectorStore correctly applies FilterOperator.GT/GTE/LT/LTE in filters for datetime.
llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/tests/test_opensearch_client.py