Having Issue with multiple filters

final_response = index.query(
        "parent_id": {"$eq": id_value},
        "grandparent_id": {"$eq": id_value},

When the filter contains two key-value pairs, it returns an empty array:

This Not

    "parent_id": {"$eq": id_value},
    "grandparent_id": {"$eq": id_value},

However, when the filter contains only one key-value pair, it returns an array of chunks, even though I have many chunks in my database that contain both parent_id, grandparent_id the values in their metadata I’m querying for:

This work

    "parent_id": {"$eq": id_value},

Hi @usama.javed

Check out the docs on metadata filtering here: Filtering with metadata

Using multiple filters you will have to use the syntax provided and select one of the operators for multiple filters, be it $and or $or

Try something like:

{"$and": [{"parent_id": "id_value"}, {"grandparent_id":"id_value"}]}

Hope this helps

EDIT: The original post’s filter with two metadata is correct See more: Filtering with metadata

Thanks @Jasper,
Yes, I also tried this and it didn’t work.

Hm. How about using the Pinecone Dashboard?

This way you can see directly if the data and metadata are present and correct. If this will work (you get results you are seeking). Then something is wrong with the code you are using. If this will not produce the result, then something is up with the data I would say.

Also I just noticed that your original syntax for the filter should be fine (will add an edit to my previous comment).