Introducing vector database capabilities in Azure Cosmos DB for NoSQL (Public Preview)

James Codella

 We are excited to announce that native vector indexing and search in Azure Cosmos DB for NoSQL is now available in preview! Azure Cosmos DB is the world’s first full-featured serverless database with vector search and features multiple vector index options from flat (exact), quantized flat, and a new DiskANN-based index. DiskANN is a suite of highly scalable, accurate, and cost-effective approximate nearest neighbor (ANN) algorithms, developed at Microsoft Research, for low-latency and cost-effective vector search at any scale.

You can take advantage of Azure Cosmos DB’s rich features such as a NoSQL query syntax to combine vector search with query filters that can increase the relevancy and accuracy of your vectors searches. You’ll also get all the benefits of Azure Cosmos DB’s flexibility, instant autoscale, 99.999% SLA, geo-replication, and more! Store your data and vectors together, eliminating the need to store vectors in a separate vector database and realize improved consistency, synchronization between vectors and data, and a reduction in the complexity and costs of AI applications.

What is DiskANN?

DiskANN is a suite of scalable approximate nearest neighbor search algorithms designed for efficient vector search at any scale. It offers high recall, high queries per second (QPS), and low query latency even for billion-point datasets. This makes it it a powerful tool for handling large volumes of data. Learn more about DiskANN from Microsoft.

Image DiskANN

  • DiskANN is a graph-based indexing and search system that performs fast and accurate approximate nearest neighbor (ANN) search at any-scale.
  • It primarily uses an SSD-based index to scale to an order of magnitude more points compared to in-memory indices, while still retaining high QPS and low latency.
  • Quantized (compressed) vectors are kept in memory, and DiskANN balances interactions between the two to offer low latency and high accuracy.
  • DiskANN is based on a novel graph index called Vamana that is more versatile than existing graph indices by maintaining accuracy despite many insertions, modifications, and deletions, without the need for expensive index rebuilds.

The DiskANN Advantage

Scalability

  • DiskANN vector indexes are stored on high-speed SSDs, while compressed vectors are stored in memory.  This reduces memory-footprint of the vector index, enabling planet-sized scalability for vector search scenarios.

Low Latency

  • The DiskANN graph index construction makes it very efficient during search, minimizing the number of SSD reads to achieve high throughput and low latency.

High Accuracy

  • During index construction, nodes in the graph are connected to diverse neighbors to improve recall. After the search operation, the results are re-ranked using the full-precision vectors providing high accuracy.

Low Cost

  • Because the quantized vectors are stored in memory and the full-precision graph is stored on SSDs, it’s much less expensive to maintain and operate DiskANN-based indexes. This results in lower RU costs for your vector search queries.

Robust to Insertions, Deletions, and Modifications

  • The DiskANN graph index is capable of supporting transactional workloads and does not degrade over time with high volumes of inserts, updates, or deletes. This is a differentiator among typical vector databases in the market today, which are built using HNSW and other less robust methods that require computationally expensive full index rebuilds to maintain accuracy.

The benefits of DiskANN, combined with the instant & dynamic autoscale, global replication, and industry leading 99.999% SLA of Azure Cosmos DB make for an unparalleled database for managing both your operational and vector data workloads.

What vector index options are available?

There are multiple types of vector index policies that can be defined for a Cosmos DB collection. Learn more about vector indexing in Azure Cosmos DB

  • Flat index is an exact (sometimes called brute-force) approach to vector indexing. The vectors are placed on the Azure Cosmos DB index and referenced for efficient lookup. This may be a good option to use in scenarios where 100% accuracy of vector searches is required, and both the dimensionality of the vectors is small.
  • Quantized Flat index is also an exact index, but the vectors are quantized (compressed) before being added to the Azure Cosmos DB index. This is very efficient and uses the same quantization method featured in DiskANN. Note: Quantized Flat index needs least 1,000 vectors to ensure quantization accuracy.
  • DiskANN enables approximate nearest neighbors (ANN) search at scale, with efficiencies that reduce RU cost and latency. This is extremely efficient and low-cost, especially when you expect to scale to larger scenarios. Note: using the DiskANN index requires enrollment in a separate preview as it’s still in an early preview version.

This table provides a good guide for the different index types and their strengths:

Index type Description When to use it? Max # of dimensions RU Cost Speed Accuracy
Flat Exact search on full vectors 100% accuracy is required

The container has <10k vectors

Vectors are small in size

505 High Slow Highest
Quantized Flat Exact search on quantized vectors. Faster, with slight accuracy reduction. High accuracy is needed

The container has >1,000 vectors

Vectors are larger in size

The scenario is scoped to at most 100k vectors

4096 Medium Medium High
DiskANN Fast, approximate search at any scale. In any scenario where scale is expected 4096 Lowest Fast High

 

 

Enroll in the Vector Search Preview

Vector search in Azure Cosmos DB for NoSQL is a preview feature and requires enrollment via the Features page of your Azure Cosmos DB resource . Follow the below steps to register:

Image Screenshot 2024 05 20 at 4 34 06 PM 1. Navigate to your Azure Cosmos DB for NoSQL resource page.

2. Select the “Features” pane under the “Settings” menu.

3. Select “Vector Search in Azure Cosmos DB for NoSQL”.

4. Read the description of the feature and confirm you want to enroll in the preview.

5. Select “Enable” to enroll in the preview.

 

Next Steps

The integration of vector search capabilities into Azure Cosmos DB for NoSQL marks a significant advancement in database technology, offering unparalleled scalability, efficiency, and accuracy. With the introduction of DiskANN and other vector indexing options, Azure Cosmos DB provides robust solutions for managing large-scale vector data alongside your operational data. Enroll in the Vector Search Preview today and explore the future of AI-driven applications with the powerful features of Azure Cosmos DB.

About Azure Cosmos DB

Azure Cosmos DB is a fully managed and serverless distributed database for modern app development, with SLA-backed speed and availability, automatic and instant scalability, and support for open-source PostgreSQL, MongoDB and Apache Cassandra. Try Azure Cosmos DB for free here. To stay in the loop on Azure Cosmos DB updates, follow us on X, YouTube, and LinkedIn.

To quickly build your first database, watch our Get Started videos on YouTube and explore ways to dev/test free.

0 comments

Leave a comment

Feedback usabilla icon