Metadata filter working for one key, but returning no results when either of two other keys are specified

Hi! I’ve got a database with 185 vectors, created using langchain’s Pinecone wrapper. These vectors have three metadata keys: “source”, “text” and “topic”. For example:

{
'id': 'c0493d03-e942-4757-bbd0-e25a854c9bc0',
'metadata': {
    'source': 'pgcps_kb_text.csv',
    'text': 'To schedule a parent-teacher conference...'
    'topic': 'academic'},

If I index.query the database with no filters, I get the results I expect returned. If I run the same query and add filter={"source":"pgcps_kb_text.csv"} as a param, I also get the results I expect (that value is currently the same on all 185 vectors). However, if I instead add filter={"topic":"academic"} (or filter on the "text" metadata, I consistently get 0 results, even with all other parameters the same.

Why are some metadata filters returning no results, even when the filter should be met? Just to confirm things are Pythonically-true, I ran:

res = index.query(
    vector=query_embedding,
    namespace='pgcps',
    top_k=5,
    include_metadata=True,
    filter={"source": "pgcps_kb_text.csv"}
)
if len(res["matches"]) > 0:
    print(res["matches"][0]["metadata"]["topic"] == "academic")

which returns True, but again changing the filter param to {"topic": "academic"} returns no matches.

Thank you!

It is likely that the langchain library under the hood was applying the metadata_config parameter which allowed you to enable/disable filtering for different fields. I don’t believe that still applies, and for gcp-starter indexes all metadata is filterable, there is no metadata_config parameter.