Implement AI and Analytics capabilities in database solutions
Analytical store and Synapse Link
Azure Synapse Link enables a columnar analytical store on a container, letting Synapse Spark or serverless SQL pools query operational data without consuming transactional request units. Enable it per container (ideally at creation), choose the sync mode, and remember the two clear separations: analytical data is read-only and cannot serve transactional reads, and analytical queries do not touch the transactional partitions. This is the answer whenever a question wants large aggregation or reporting without impacting application latency.
Vector search and RAG
Vector search in the NoSQL API requires three coordinated pieces: a vector embedding policy on the container declaring each path, its dimensions, data type, and distance function; a matching vector index (flat, quantizedFlat, or diskANN) in the indexing policy; and embeddings stored as arrays on the documents. diskANN is the low-latency approximate choice for large sets, while flat indexes guarantee exact results for smaller sets; each index type has its own dimension ceiling, so mismatched dimensions fail at write time. A typical retrieval-augmented generation pattern generates embeddings with Azure OpenAI, stores them in Cosmos DB, and uses vector plus filter queries; a semantic cache reuses prior answers keyed by prompt embeddings.
Keeping the index fresh
Use the change feed to react to inserts and updates: the change feed processor (or the Azure Functions Cosmos DB trigger) reads changes in order within a partition key, using a leases container for parallel consumers. In all-versions-and-deletes mode it also surfaces deletions, which matters when embeddings must be removed. Trap: the default change feed omits deletes, and documents written before embeddings existed simply never match a vector query.