We’re excited to announce the preview of DiskANN vector indexing for vCore-based Azure Cosmos DB for MongoDB! This feature empowers you to perform efficient, low-latency searches on large vector datasets, making it perfect for scaling applications that depend on fast similarity searches—like recommendation engines, document retrieval, and AI insights. With DiskANN, you can “do more with less” by allowing you to handle larger vector datasets and achieve superior search performance even on smaller SKUs.
What Is DiskANN?
Microsoft Research developed DiskANN, which already powers high-speed, large-scale vector searches in Microsoft services like Bing and Microsoft 365. DiskANN (Disk-based Approximate Nearest Neighbor) goes beyond traditional in-memory methods by using SSD storage for vector indexing, enabling your applications to handle massive datasets without requiring a large amount of RAM. This approach revolutionizes applications that need both speed and scale. DiskANN also resolves common issues in filtered vector searches, delivering highly accurate results even when complex filters apply.
DiskANN achieves an optimal balance of high recall, low latency, and high throughput, which are essential for modern applications like recommendation engines and Retrieval-Augmented Generation (RAG) models.
Why Choose DiskANN in Azure Cosmos DB for MongoDB?
Here’s how DiskANN stands out in Azure Cosmos DB for MongoDB:
- Optimized Storage for Scalability By levereaging RAM and high-speed SSDs, DiskANN enables you to scale beyond memory limitations while maintaining fast search speeds. This means you can work with millions of vectors without overloading your resources, ideal for applications that need efficient storage and retrieval of massive data.
- Advanced Vector Quantization for Performance DiskANN keeps quantized (compressed) vectors in memory, balancing memory efficiency with search accuracy. This allows applications to deliver fast and accurate results, perfect for real-time applications without high memory demands.
- Iterative Post-Filtering for Enhanced Accuracy DiskANN’s iterative post-filtering improves the accuracy of filtered search results by progressively refining the search until the top results meet all filter criteria, like “open” or “within a 30-mile radius.” This process ensures reliable results even in complex searches.
- High Throughput with Lower Resource Use DiskANN provides up to 5x higher throughput than traditional methods while using up to 10x less memory. With SSDs backing the search process, DiskANN can perform high-speed searches on large datasets with sub-15ms latency, ideal for high-demand scenarios.
- Cost-Effective Storage and Operational Savings DiskANN achieves a compression ratio of 98.5%, compressing vectors to 1/64th their size.
Optimized Filtered Vector Search
Vector similarity search enables you to quickly find data that closely matches a given query, like identifying related items in large datasets. Filters often refine these searches, ensuring results meet specific criteria such as location or status. For instance, you might search for “open restaurants within a 30-mile radius” to focus on relevant dining options nearby. DiskANN in Azure Cosmos DB enhances filtered vector search by using iterative post-filtering, which refines search results without slowing down performance. Here’s how it works:
- Initial Similarity Search DiskANN first retrieves items based on vector similarity, ranking results by relevance to the query vector.
- Applying Filters Next, DiskANN applies user-defined filters—such as “is open” and “within a 30-mile radius”—to focus only on matching results.
- Iterative Refinement Finally, DiskANN iterates through rows based on similarity order until it finds the desired number of results that satisfy the filters.
Here’s an example query for finding open restaurants within 30 miles:
"$search": {
"cosmosSearch": {
"path": "contentVector",
"vector": query_vector,
"k": 5,
"filter": {
"$and": [
{"is_open": {"$eq": 1}},
{"location": {"$geoWithin": {"$centerSphere": [[-119.719, 34.410], 30 / 3963.2]}}}
]
}
}
}
DiskANN’s iterative filtering approach ensures your filtered searches are as accurate and relevant as possible, even when working across large datasets.
Get Started with DiskANN in Azure Cosmos DB for MongoDB
DiskANN is now available in public preview for Azure Cosmos DB for MongoDB (vCore) on M40 clusters and higher.
Azure Portal
To enable it, navigate to the ‘Preview Features’ area in your Azure subscription, select ‘Microsoft.DocumentDB,’ and register for the ‘DiskANN in Azure Cosmos DB for MongoDB (vCore)’ preview. During this early preview phase, performance may vary as we continue to roll out optimizations. Expect ongoing enhancements to improve speed, scalability, and efficiency as we refine the feature based on user feedback and usage patterns. Learn More
Azure CLI
Alternatively, you can enable DiskANN vector index in Azure Cosmos DB for MongoDB (vCore) via CLI:
- Get the Cluster Connection String: Retrieve the connection string from the Azure Portal for your Cosmos DB cluster.
- Authenticate and Retrieve Token: Log in and obtain an access token with:
az login az account get-access-token --resource-type arm
- Send PATCH Request to Enable DiskANN: Use the connection string and token to send a PATCH request with the updated property name:
curl -X PATCH \ -H "Authorization: Bearer <your_token>" \ -H "Content-Type: application/json" \ -d "{\"properties\": {\ "previewFeatures": ["DiskANNIndex"]}}" \ "<your_connection_string>"
- Verify Enablement: Confirm that “mongoDiskANNIndex”: {“mode”: “Enabled”} appears in the response. If not, you might get an error “diskANN is not supported on this cluster” message.
Note: The PATCH request overrides the previously enabled preview features on your cluster.
Integrating DiskANN with Azure Cosmos DB for MongoDB adds a powerful new dimension to building scalable, efficient, AI-driven applications. With advanced vector search capabilities, DiskANN empowers you to deliver fast, accurate results on massive datasets, unlocking new potential for recommendation systems, document retrieval, and AI insights. Explore how DiskANN and Azure Cosmos DB for MongoDB can elevate your applications:
Leave a review
Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we’ll gift you $50. Get started here.
About Azure Cosmos DB
Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.
Try Azure Cosmos DB for free here. To stay in the loop on Azure Cosmos DB updates, follow us on X, YouTube, and LinkedIn.
0 comments
Be the first to start the discussion.