Error when creating Vector Index for MongoDB vCore

Tyler Suard 155 Reputation points
2024-04-04T21:14:35.2566667+00:00

Hello. I uploaded around 150,000 documents to my MongoDB vCore. My searches were returning either terrible results or no results at all, so I decided to recreate the index. That is when I got this error message:

User's image

I can't create an index with fewer documents. Also, if I create an index before inserting documents into the collection, then the index won't contain those documents. How can I fix this issue? MogoDB vCore should be able to handle many documents. In the documentation it mentions creating an index when there are over a million documents.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
{count} vote

1 answer

Sort by: Most helpful
  1. James Codella 10 Reputation points Microsoft Employee
    2024-04-05T18:38:55.11+00:00

    In general if your resource runs out of memory, you can try either scaling up the resource to a higher cluster tier, or scaling down the index parameters (e.g., for HNSW you can reduce m or efConstruction and this will reduce the memory footprint of the index. However, you may lose some accuracy in doing so.)

    For more than ~10k 1536-dimensional vectors, I wouldn't recommend anything lower than M40. Also, if you scale up to an M40 or above you'll be able to create an HNSW index. HNSW should offer you better latency, throughput, and accuracy compared to IVF at the scale you have.

    For example, I was able to have >1M vectors on an M50 without issue using HNSW.

    1 person found this answer helpful.
    0 comments No comments

Your answer

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