Problem with Azure Cosmos DB for MongoDB vCore using a DiskANN Index with Filtering

Jesper Echardt 0 Reputation points
2025-01-03T16:33:59.1966667+00:00

According to: https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/vcore/vector-search?WT.mc_id=Portal-Microsoft_Azure_Resources&tabs=diskann there should be possible to use vector search with DiskANN Index with Filtering. There is even an example (that I have followed). Apart from following the example I have also (to my knowledge) followed all pre-requisites (e.g., M40 cluster tier, enabling of DiskANN on the cluster, enabled the "filtering vector search" feature in the "Preview Features" tab on my Azure Subscription).

What works: vector search using DiskANN (which verifies that most things are configures set-up correctly)

What does NOT work: filtering

Again; I have enabled the "filtering vector search" feature in the "Preview Features" tab on my Azure Subscription and verified that it is "registered".

I get the following error message:

pymongo.errors.OperationFailure: $filter is not supported for vector search yet., full error: {'ok': 0.0, 'errmsg': '$filter is not supported for vector search yet.', 'code': 115, 'codeName': 'CommandNotSupported'}

I am little bit confused, given that I have followed the documentation (see link above) which states that filtering is available (in preview).

Can anyone help me with this problem?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,725 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Mahesh Kurva 1,780 Reputation points Microsoft Vendor
    2025-01-03T19:45:56.05+00:00

    Hi @Jesper Echardt,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    As I understand, you are encountering an error related to filtering when attempting to use vector search with DiskANN on Azure Cosmos DB.

    Here are a few steps you can take to troubleshoot this issue:

    • Double-check that the “filtering vector search” feature is fully registered and active in your Azure Subscription. Sometimes, there might be a delay in the feature becoming fully operational.

    For more information, please refer the document: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/preview-features?tabs=azure-portal

    • Ensure you are using the latest versions of pymongo and any related Azure SDKs. Updates might include bug fixes or enhancements that address this issue.
    • Revisit the documentation to ensure that all steps and configurations are correctly followed. Sometimes, small details can be missed.
    • Since this feature is in preview, there might be known issues or limitations that are not fully documented. Reaching out to Azure support request.

    For more information, please refer the document: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/preview-features?tabs=azure-portal#register-preview-feature

    Hope this helps. Do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


  2. Sajeetharan 2,261 Reputation points Microsoft Employee
    2025-01-09T04:15:49.0866667+00:00

    Have you checked the documentation?

    To use filtered vector search effectively, you first need to define an index for your filter alongside the vector index.

    db.runCommand({ "createIndexes": "<collection_name", "indexes": [ { "key": { "<property_to_filter>": 1 }, "name": "<name_of_filter_index>" } ] });
    
    

  3. Jesper Echardt 0 Reputation points
    2025-01-10T07:28:03.1033333+00:00

    Yes, as I have stated previously in the thread, I have read the documentation (and to my knowledge I have also followed all the requirements and pre-requisites)).

    Also, as can be seen in the provided code (by me) in this thread/errand, I have defined an index with the db.command (see details earlier in the thread).


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.