How to add multiple columns i.e. fieldnames in mongo index_overview and python code?

Below’s the vector search index which i’m using for filtering on Company name

{
  "fields": [
    {
      "numDimensions": 1536,
      "path": "embedding",
      "similarity": "cosine",
      "type": "vector"
    },
    {
      "path": "Company",
      "type": "filter"
    }
  ]
}

I want to add another fieldname named date, how do i add that in the above? And below’s the python code where i’m applying pre_filter on Company column

vectorstore_retriver_args["pre_filter"] = {"Company": {"$eq": Company}}

how do i add another column, like i need pre_filter now to be applied on 2 columns? Can anyone assist me with this?

Hey @Nithin_Reddy1 , great question! For any additional column you want to filter on, you can add it to the the "fields" list you have supplied similar to how you’ve already done company. See this link for an example.

For your case, it should look something akin to this:

{
   ...
   "fields": [
        {
            "numDimensions": 1536,
            "path": "embedding",
            "similarity": "cosine",
            "type": "vector",
        },
        {
            "path": "Company",
            "type": "filter",
        },
        {
            "path": "Date",
            "type": "filter",
        }
   ]
}

To query against this, your pre_filter query can leverage the $and operator

vectorstore_retriever_args["pre_filter"] = {"$and": [ {"Company": {"$eq": company}}, {"Date": {"$eq": date}}]}

For more eligible operators, check our documentation here on $vectorSearch.fields.