Design and implement AI retrieval
Unlock the complete study guide + 25 practice exams totaling 1,500 questions.
Bundled into the existing Building AI Applications with Azure Cosmos DB premium course — no separate purchase.
14-day refund guarantee on one-time purchases and your first subscription charge.
Included in this chapter:
- Three ways to retrieve from one container
- Setup steps for full-text and vector search
- Declaring full-text paths and indexes
- How full-text analysis processes text
- Full-text filter patterns with FullTextContains
- Ranking by relevance with FullTextScore
- Setting up vector search on a container
- Sizing vectors: dimensions and precision
- Choosing a vector index type
- Partitioning a container for vector search
- Sharding DiskANN with vectorIndexShardKey
- Querying vectors with VectorDistance
- Combining rankings with hybrid search
- Optimizing full-text and vector performance
- How RAG uses Azure Cosmos DB for retrieval
- Preparing grounding chunks
- Embedding chunks and queries consistently
- Improving retrieval queries for RAG
- Evaluating retrieval and generated answers
- Recognizing retrieval scenarios in exam questions
Vector index types: flat vs quantizedFlat vs diskANN
| Characteristic | flat | quantizedFlat | diskANN |
|---|---|---|---|
| How a search runs | Brute force over full vectors | Brute force over quantized (compressed) vectors | Approximate nearest neighbor (ANN) search |
| Recall | 100%, guaranteed exact | May be slightly below 100%, from quantization | High but not guaranteed; tunable per query |
| Maximum dimensions | 505 | 4,096 | 4,096 |
| Recommended search scope | Small, focused searches | 50,000 vectors or fewer | More than 50,000 vectors |
| Minimum indexed vectors | No minimum stated | 1,000, otherwise a full scan | 1,000, otherwise a full scan |
| Optional build settings | None | quantizationByteSize, quantizerType | quantizationByteSize, quantizerType, indexingSearchListSize, vectorIndexShardKey |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.
Also tested in
- AI-103 Developing AI Apps and Agents on Azure Retrieval and grounding pipelines with Azure AI Search
- AI-200 Developing AI Cloud Solutions on Azure Run vector similarity search and RAG on PostgreSQL
- AI-200 Developing AI Cloud Solutions on Azure Store embeddings and run vector similarity search in Cosmos DB
- AI-300 Operationalizing Machine Learning and Generative AI Solutions Optimize RAG Performance and Accuracy
References
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/vector-search
- https://learn.microsoft.com/en-us/azure/cosmos-db/gen-ai/hybrid-search
- https://learn.microsoft.com/en-us/credentials/certifications/resources/study-guides/dp-420
- https://learn.microsoft.com/en-us/azure/cosmos-db/gen-ai/full-text-search
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-dotnet-vector-index-query
- https://learn.microsoft.com/en-us/azure/cosmos-db/index-policy
- https://learn.microsoft.com/en-us/rest/api/cosmos-db-resource-provider/sql-resources/create-update-sql-container?view=rest-cosmos-db-resource-provider-2025-04-15
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextscore
- https://learn.microsoft.com/en-us/azure/cosmos-db/gen-ai/full-text-search-faq
- https://learn.microsoft.com/en-us/azure/cosmos-db/gen-ai/stopwords
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontainsall
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontainsany
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/fulltextcontains
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/order-by-rank
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-python-vector-index-query
- https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-generate-embeddings
- https://learn.microsoft.com/en-us/azure/cosmos-db/set-throughput
- https://learn.microsoft.com/en-us/azure/cosmos-db/gen-ai/vector-search-performance-tips
- https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-information-retrieval
- https://learn.microsoft.com/en-us/azure/cosmos-db/synthetic-partition-keys
- https://learn.microsoft.com/en-us/azure/cosmos-db/gen-ai/sharded-diskann
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance
- https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/rrf
- https://learn.microsoft.com/en-us/azure/cosmos-db/gen-ai/rag
- https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-chunking-phase
- https://learn.microsoft.com/en-us/azure/search/vector-search-how-to-chunk-documents
- https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/prebuilt/layout?view=doc-intel-4.0.0
- https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-enrichment-phase
- https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-agentic
- https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-llm-evaluation-phase