{"id":11294,"date":"2025-11-18T01:30:43","date_gmt":"2025-11-18T09:30:43","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=11294"},"modified":"2025-12-03T20:15:25","modified_gmt":"2025-12-04T04:15:25","slug":"how-kraft-heinz-achieved-1400x-faster-data-lineage-with-azure-documentdbs-diskann-vector-search-and-hybrid-search","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/how-kraft-heinz-achieved-1400x-faster-data-lineage-with-azure-documentdbs-diskann-vector-search-and-hybrid-search\/","title":{"rendered":"How Kraft Heinz achieved 1,400x faster data lineage with Azure DocumentDB\u2019s DiskANN vector search and hybrid search"},"content":{"rendered":"<p><em>This article is authored by Gurvinder Singh, Principal Cloud Engineer at The Kraft Heinz Company.<\/em><\/p>\n<hr \/>\n<p><strong>ICYMI:<\/strong> Hear how Kraft Heinz built an AI-powered data lineage solution leveraging Azure DocumentDB hybrid search and graph querying capabilities &#8211; watch the Ignite session here: <a href=\"https:\/\/ignite.microsoft.com\/en-US\/sessions\/BRK132?source=sessions\">Move fast, save more with MongoDB-compatible workloads on DocumentDB<\/a><\/p>\n<hr \/>\n<h1>The enterprise-scale challenge: Data lineage across 50+ interconnected systems<\/h1>\n<p>At Kraft Heinz, we operate one of the world\u2019s largest CPG data ecosystems with more than 200 brands and 50+ interconnected enterprise systems\u2014including SAP, Oracle, Snowflake, and Power BI\u2014connected through 1,000+ data transformation pipelines. Our data footprint stretches from ingredient sourcing to retail analytics. Every decision, whether it\u2019s optimizing a production line or forecasting demand, depends on data moving reliably through dozens of interconnected systems.<\/p>\n<p>With so much data in motion, even small changes can have big effects. A missed pipeline job or schema update can ripple through analytics, dashboards, and reports. That\u2019s where data lineage becomes essential. <strong>Data lineage is <\/strong><strong>the GPS for enterprise data<\/strong>, giving teams visibility into how information flows, transforms, and impacts downstream systems.<\/p>\n<p>Our lineage platform applies graph principles, modeling data as nodes and relationships so dependencies can be traced at a glance. This helps data engineers pinpoint issues quickly, assess downstream impact, and make confident changes without slowing innovation. For a company operating at global scale, lineage isn\u2019t optional\u2014it\u2019s foundational to maintaining data quality and trust.<\/p>\n<h1>The first iteration: data lineage with a third-party graph database<\/h1>\n<p>Our first iteration used a third-party graph database platform to build our data lineage solution. It proved powerful and delivered measurable results. Root cause analysis dropped from hours to minutes, data quality decisions accelerated, and data engineers gained full visibility into data flows.<\/p>\n<p>But there were some limitations that emerged over time:<\/p>\n<ol>\n<li>Cost structure: Significant annual recurring licensing fees<\/li>\n<li>No consumption-based pricing model available<\/li>\n<li>Performance: Complex lineage graph queries with multi-level graph traversal were slow or timing out<\/li>\n<li>Operational overhead: Separate database island outside of Azure ecosystem<\/li>\n<\/ol>\n<p>In this blog, I&#8217;ll share why we chose <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/mongodb\/vcore\/oss\">Azure DocumentDB<\/a> for data lineage, how we rebuilt the platform on Azure, where we\u2019re heading next as we bring AI into lineage.<\/p>\n<h1>Solving two challenges: reducing costs and operational overhead<\/h1>\n<p>We set two clear objectives and key results (OKRs): reduce annual licensing costs and eliminate operational overhead from managing a separate third-party graph database island outside of the Azure ecosystem. Working with our Microsoft account team, we selected Azure DocumentDB\u2014built natively on Azure alongside our data infrastructure.<\/p>\n<p>But the real win? \u2013 The CosmosAIGraph Solution we built that took our lineage solution at enterprise scale. We will talk about it in the next section.<\/p>\n<h1>Graph reimagined using CosmosAIGraph<\/h1>\n<p>Data lineage at Enterprise scale requires the following two fundamentally different capabilities:<\/p>\n<ol>\n<li>Deterministic, Authoritative Lineage (high precision): Ability to answer the relationship question with absolute certainty<\/li>\n<li>Semantic similarity: Ability to find datasets when keywords do not match<\/li>\n<\/ol>\n<p>The CosmosAIGraph solution, as shown in the diagram below, combines both capabilities using a dual-pattern RAG architecture that integrates GraphRAG and OmniRAG. Let&#8217;s explore why dual-pattern RAG architecture is essential and how this works.<\/p>\n<p>The solution has three main elements:<\/p>\n<ol>\n<li><strong>Azure DocumentDB<\/strong>: Persistent store for data-lineage data, edges, nodes, high dimensional vector embeddings, and session data<\/li>\n<li><strong>Two Microservices<\/strong>: Deployed in AKS cluster\n<ul>\n<li><strong>Graph Microservice: <\/strong>Handles constructing an in-memory RDF knowledge graph with full ontology reasoning using OWL schema definitions.<\/li>\n<li><strong>Web Microservice:<\/strong> Handles user queries and response completion<\/li>\n<\/ul>\n<\/li>\n<li><strong>Azure OpenAI<\/strong>: Responsible for Intelligent intent detection in real time<\/li>\n<\/ol>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/Kraft-Heinz-Azure-DocumentDB-architecture.png\"><img decoding=\"async\" class=\"alignleft size-full wp-image-11295\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/Kraft-Heinz-Azure-DocumentDB-architecture.png\" alt=\"Kraft Heinz Azure DocumentDB architecture image\" width=\"1382\" height=\"735\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/Kraft-Heinz-Azure-DocumentDB-architecture.png 1382w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/Kraft-Heinz-Azure-DocumentDB-architecture-300x160.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/Kraft-Heinz-Azure-DocumentDB-architecture-1024x545.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/Kraft-Heinz-Azure-DocumentDB-architecture-768x408.png 768w\" sizes=\"(max-width: 1382px) 100vw, 1382px\" \/><\/a><\/p>\n<p>The GraphRAG pattern leverages the <strong>RDF graph microservice<\/strong>. This microservice loads entity and relationship data from Azure DocumentDB at startup and constructs an in-memory RDF knowledge graph using triples and ontology. Using SPARQL queries, it provides <strong>deterministic, multi-hop lineage traversal<\/strong>\u2014answering questions like:<\/p>\n<ul>\n<li>&#8220;Which downstream reports depend on this table?&#8221;<\/li>\n<li>&#8220;What happens if I change this field in SAP?&#8221;<\/li>\n<\/ul>\n<p>The RDF microservice maintains the complete ontology schema using Web Ontology Language (OWL) and triple relationships in memory, enabling fast logical inference and semantic reasoning.<\/p>\n<p>However, the problem is that the RDF works well for relationship traversal or deterministic lineage, but it\u2019s not enough for enterprise data lineage. It lacks semantic discovery and keyword search at scale. This is where <strong>Azure DocumentDB and OmniRAG<\/strong> pattern come in<\/p>\n<p><strong>Example: <\/strong>Imagine you have a table or attribute with a long textual description that&#8217;s important and defines the business context. Someone searches for that information by keywords or in different terms; the deterministic GraphRAG would fail, and we would need a completely different approach.<\/p>\n<h3>OmniRAG: Intelligent Orchestration Across Multiple Data Sources<\/h3>\n<p>The OmniRAG pattern utilizes Azure OpenAI and Semantic Kernel to detect the intent of user queries and route them to the most suitable data source. Here is an example:<\/p>\n<ul>\n<li>&#8220;What downstream reports depend on this table?&#8221; \u2192GraphRAG, Route to RDF Graph (SPARQL)<\/li>\n<li>&#8220;Find datasets similar to customer master&#8221; \u2192 Route to DocumentDB Vector Search<\/li>\n<li>&#8220;Find datasets containing &#8216;PII'&#8221; \u2192 Route to DocumentDB Full-Text Search<\/li>\n<li>&#8220;Show me customer data updated recently&#8221; \u2192 Route to Multiple Sources + Merge<\/li>\n<\/ul>\n<p>When OmniRAG routes queries to Azure DocumentDB, it leverages both vector and full-text search through Hybrid Search:<\/p>\n<ul>\n<li>SSD-backed <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/mongodb\/vcore\/vector-search?tabs=diskann\">DiskANN<\/a> vector search: Finds datasets by meaning using high-dimensional vector embeddings<\/li>\n<li>Full-text search (Keyword intelligence): Find datasets by exact keywords<\/li>\n<\/ul>\n<p>These two methods produce separate result sets. Azure DocumentDB\u2019s <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/mongodb\/vcore\/hybrid-search\">Hybrid Search<\/a> uses Reciprocal Rank Fusion (RRF) to intelligently merge them, making sure documents that match both semantic AND keyword criteria rank highest.<\/p>\n<p>This dual-pattern RAG architecture\u2014GraphRAG for deterministic accuracy and OmniRAG for smart orchestration\u2014enables enterprise-scale data lineage. By directing each query to its best source, the solution avoids unnecessary, costly knowledge graph traversals for simple lookups and overcomes semantic limits on relationship queries.<\/p>\n<h1>Proven impact: Upfront licensing costs saved annually and 1,400x performance gain<\/h1>\n<p>Modernizing our data lineage platform delivered measurable gains in costs, speed, and operational efficiency. Moving from a fixed-license based, third-party graph database to a consumption-based vCore-model of Azure DocumentDB eliminated annual licensing burden in annual licensing fees, reducing overhead and freeing engineers from maintaining a separate database island.<\/p>\n<p>Performance gains have been equally striking. Query response time dropped from 18,634 milliseconds to as low as 3 to 13 milliseconds\u2014a 1,400x to 6,200x improvement. Graph traversals that once stalled analytics now execute almost instantly, keeping engineers focused on insight rather than waiting for data to load. The shift from third-party graph database infrastructure to Azure-native, cloud-optimized services redefined what speed and responsiveness look like at enterprise scale.<\/p>\n<p>The new lineage platform has also reshaped how our data engineers work. Managing it through the same Azure pipelines, monitoring, and security controls that govern the rest of our environment has simplified daily operations and reduced the risk of errors. Teams no longer move between systems or manage separate credentials, which means faster responses and fewer points of failure.<\/p>\n<p>&nbsp;<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-color: #fcfcfc; background-color: #fcfcfc;\">\n<tbody>\n<tr>\n<td style=\"width: 21.0852%; border-style: hidden;\"><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot.jpg\"><img decoding=\"async\" class=\"alignleft size-full wp-image-11296\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot.jpg\" alt=\"gurvinder singh headshot image\" width=\"800\" height=\"800\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot.jpg 800w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot-300x300.jpg 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot-150x150.jpg 150w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot-768x768.jpg 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot-24x24.jpg 24w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot-48x48.jpg 48w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/gurvinder-singh-headshot-96x96.jpg 96w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/td>\n<td style=\"width: 78.9148%; border-style: hidden;\"><span style=\"font-size: 12pt;\"><strong>Gurvinder Singh<\/strong> is Principal Cloud Engineer at Kraft Heinz, with 15+ years empowering product teams and elevating excellence in developer enablement and enterprise transformation on Microsoft Azure. He leads federated product development initiatives and delivers sustainable, secure, and cost-optimized cloud solutions that enhance developer agility. By pioneering reusable architecture templates and automation frameworks, Gurvinder empowers teams to deliver future-ready, cloud-native solutions. <\/span><\/p>\n<p><span style=\"font-size: 12pt;\">As co-author of three Microsoft Press books published by Pearson, Gurvinder contributes to the broader developer community through thought leadership and technical expertise.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><\/h2>\n<h2>About Azure Cosmos DB<\/h2>\n<p>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.<\/p>\n<p>To stay in the loop on Azure Cosmos DB updates, follow us on <a href=\"https:\/\/twitter.com\/AzureCosmosDB\">X<\/a>,\u00a0<a href=\"https:\/\/aka.ms\/AzureCosmosDBYouTube\">YouTube<\/a>, and\u00a0<a href=\"https:\/\/www.linkedin.com\/company\/azure-cosmos-db\/\">LinkedIn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is authored by Gurvinder Singh, Principal Cloud Engineer at The Kraft Heinz Company. ICYMI: Hear how Kraft Heinz built an AI-powered data lineage solution leveraging Azure DocumentDB hybrid search and graph querying capabilities &#8211; watch the Ignite session here: Move fast, save more with MongoDB-compatible workloads on DocumentDB The enterprise-scale challenge: Data lineage [&hellip;]<\/p>\n","protected":false},"author":179851,"featured_media":11341,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1610,15,1809],"tags":[],"class_list":["post-11294","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-mongodb-api","category-customers"],"acf":[],"blog_post_summary":"<p>This article is authored by Gurvinder Singh, Principal Cloud Engineer at The Kraft Heinz Company. ICYMI: Hear how Kraft Heinz built an AI-powered data lineage solution leveraging Azure DocumentDB hybrid search and graph querying capabilities &#8211; watch the Ignite session here: Move fast, save more with MongoDB-compatible workloads on DocumentDB The enterprise-scale challenge: Data lineage [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/179851"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=11294"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11294\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/11341"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=11294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=11294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=11294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}