Metadata filtering dynamically on query id

All of the metadata filtering examples I can find filter at query time with known values. For example:

index.query(
    vector=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
    filter={
        "genre": {"$eq": "documentary"},
        "year": 2019
    },
    top_k=1,
    include_metadata=True
)

you have to know year is 2019, and genre is documentary. Is it possible to filter on whatever metadata is currently associated with the query vector? Something like this

index.query(
    vector=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
    filter={
        "genre": <whatever genre query vector has stored>
        "year": <whatever year query vector has stored>
    },
    top_k=1,
    include_metadata=True
)

I can obviously query once to get the metadata values associated with vector and then query again, but a dynamic single query would be nice.

To clarify, do you mean query by id rather than querying with a vector? More like:

index.query(
    id="id-a",
    filter={
        "genre": <whatever genre query vector has stored>
        "year": <whatever year query vector has stored>
    },
    top_k=1,
    include_metadata=True
)

Thanks for sharing your feedback!

Pinecone

yes, by id. Or vector. Metadata filtering applies either way right?

Yes you can use filters with query by Id or Vector.

Right, but if I don’t know the filter value at query time? Can pinecone determine the associated value with an id. An example:

# I upload a few vectors with metadata called "genre" and some have the genre "comedy" and some  
# have "horror". One of the "comedy" vectors has id 123, but I don't know that it's genre is 'comedy'
pinecone.query(id='123', top_k=5, filter={'genre': 'use whatever pinecone has stored here'})

# as opposed to
result = pinecone.query(id='123', top_k=1, include_metadata=True)
pinecone.query(id='123', top_k=5, filter={'genre':result[0]['metadata']['genre'])

I’m trying to avoid querying twice