{"id":7262,"date":"2019-07-26T12:17:59","date_gmt":"2019-07-26T19:17:59","guid":{"rendered":"http:\/\/www.couchbase.com\/blog\/?p=7262"},"modified":"2025-06-13T17:22:00","modified_gmt":"2025-06-14T00:22:00","slug":"analytics-love-the-doc-model-youre-with","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/analytics-love-the-doc-model-youre-with\/","title":{"rendered":"Anal\u00edtica - Ama el modelo de m\u00e9dico con el que est\u00e1s"},"content":{"rendered":"<p>In business applications, the data is often modeled for a large number of concurrent low latency queries. If you want to gain insight by looking at trends, however, you end up wishing you had an entirely different data model. The traditional means for squaring this circle had been to move, transform, and load the data elsewhere, but this introduces its own raft of problems, including unacceptable latency, multiple sources of truth, and a lot of expense.<\/p>\n<p>Couchbase customers know that the Analytics service provides an easy way to handle real-time analytical and trend reporting on the data they have in production right now. An example of this recently came up when we worked with a customer looking to identify high-end customer activity associated with a corporate partner loyalty program. The underlying document model was clearly designed with the interactive application, rather than reporting, in mind. (This is not at all uncommon, as you may know from painful experience.) Let\u2019s take a quick look at the problem and how we solved it.<\/p>\n<h4>Example document<\/h4>\n<p>The document model in our case (supporting an online booking application) is comprised of four sections. The first section includes basic document and app identifiers. The second describes the booking information about an excursion. The third contains details on one or more itineraries associated with the booking, along with passenger requirements for one or more passengers. The final section describes the corporate loyalty programs to which each of the passengers might belong.<\/p>\n<div id=\"cb1\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false lang:default decode:true show_mixed:false show_mixed:false\">{\r\n  \"_type\": \"booking\",\r\n  \"_header\": {\r\n    \"created\": 1562888960,\r\n    \"source\": \"app\",\r\n    \"version\": \"v1.1\"\r\n  },\r\n  \"booking\": {\r\n    \"status\": \"BOOKED\",\r\n    \"bookingType\": \"agency\",\r\n    \"details\": {\r\n      \"agent\": \"FBL33\",\r\n      \"contact\": \"Arlene\",\r\n      \"seats\": 2,\r\n      \"excursion\": {\r\n        \"embarking\": 1562958000,\r\n        \"equipment\": \"123X\",\r\n        \"line\": \"SRF\",\r\n        \"fromStation\": {\r\n          \"code\": \"LAX\",\r\n          \"facilityType\": 1\r\n        },\r\n        \"toStation\": {\r\n          \"code\": \"SOL\",\r\n          \"facilityType\": 2\r\n        },\r\n        \"bookingAgency\": \"PC\",\r\n        \"agencyType\": \"3\"\r\n      }\r\n    }\r\n  },\r\n  \"itinerary\": [\r\n    {\r\n      \"daysOnboard\": 1,\r\n      \"passengers\": [\r\n        {\r\n          \"passengerNumber\": 1,\r\n          \"specialAccomodations\": false\r\n        },\r\n        {\r\n          \"passengerNumber\": 2,\r\n          \"specialAccomodations\": false\r\n        }\r\n      ],\r\n      \"itineraryType\": \"business\"\r\n    }\r\n  ],\r\n  \"passengerDetails\": [\r\n    {\r\n      \"loyaltyId\": \"aaaabbbbccccdddd\",\r\n      \"passId\": 1,\r\n      \"programType\": {\r\n        \"corporatePartner\": true,\r\n        \"partnerId\": 1\r\n      }\r\n    },\r\n    {\r\n      \"loyaltyId\": \"eeeeffffgggghhhh\",\r\n      \"passId\": 2,\r\n      \"programType\": {\r\n        \"corporatePartner\": false\r\n      }\r\n    }\r\n  ]\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<h4>Query elements<\/h4>\n<p>In order to complete the analysis, my customer was required to pull or filter on the following fields:<\/p>\n<ul>\n<li>status, equipment, embarking (converted to human-readable format), line, _type, daysOnboard, passengerNumber, loyaltyId, partnerId<\/li>\n<\/ul>\n<p>The problem, of course, is that these fields exist in entirely different hierarchical levels within the document model. Some are scalar values, readily accessible from a simple query:<\/p>\n<ul>\n<li>status,\u00a0equipment, embarking, line, _type<\/li>\n<\/ul>\n<p>Another is an element within an array (comprised of trip itineraries), which must be unnested:<\/p>\n<ul>\n<li>daysOnboard<\/li>\n<\/ul>\n<p>Within this same array is a second array (comprised of passenger details), an element of which must be used as a join key:<\/p>\n<ul>\n<li>passengerNumber<\/li>\n<\/ul>\n<p>This join key is used to access elements from within a third array, which for business application reasons is not nested within the second:<\/p>\n<ul>\n<li>loyaltyId, partnerId<\/li>\n<\/ul>\n<p>These different levels equate to different access paths, adding some complexity to the analysis. Fortunately N1QL for Analytics provides the syntactic tools we need. Below is a step-by-step description of the process you might use to build your query.<\/p>\n<h4>Step 1 &#8211; simple select of one scalar element<\/h4>\n<p>This step ought be fairly clear to people with SQL experience. We use a select statement to retrieve a scalar value from the lines bucket. We qualify the status field as part of the booking section and we limit the number of records to return.<\/p>\n<div id=\"cb2\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true\">select booking.status\r\nfrom lines\r\nlimit 1;<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<p>Query results:<\/p>\n<div id=\"cb3\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true\">[\r\n  {\r\n    \"status\": \"BOOKED\"\r\n  }\r\n]<\/pre>\n<p>&nbsp;\n<\/p><\/div>\n<h4><\/h4>\n<h4>Step 2 &#8211; Unnest and add element from first array<\/h4>\n<p>Next we add data from the itinerary section of the document. Because these elements are embedded within an array, however, we must first unnest them.<\/p>\n<div id=\"cb4\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true \">select l.booking.status,\r\n       i.daysOnboard\r\nfrom lines l\r\nunnest l.itinerary i\r\nlimit 1;<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<p>Query results:<\/p>\n<div id=\"cb5\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true \">[\r\n  {\r\n    \"status\": \"BOOKED\",\r\n    \"daysOnboard\": 1\r\n  }\r\n]<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<h4>Step 3 &#8211; Unnest and add element from second (within first) array<\/h4>\n<p>Now we add elements from the embedded passengers array. (Note that we increase our limit to make sure that we really are accessing more than one element from the array.)<\/p>\n<div id=\"cb6\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true \">select l.booking.status,\r\n       i.daysOnboard,\r\n       p.passengerNumber\r\nfrom lines l\r\nunnest l.booking.itinerary i\r\nunnest i.passengers p\r\nlimit 2;<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<p>Query results:<\/p>\n<div id=\"cb7\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true \">[\r\n  {\r\n    \"status\": \"BOOKED\",\r\n    \"daysOnboard\": 1,\r\n    \"passengerNumber\": 1\r\n  },\r\n  {\r\n    \"status\": \"BOOKED\",\r\n    \"daysOnboard\": 1,\r\n    \"passengerNumber\": 2\r\n  }\r\n]<\/pre>\n<p>&nbsp;\n<\/p><\/div>\n<h4>Step 4 &#8211; Unnest and add element from third array, accessible via join<\/h4>\n<p>The elements from the third array (passengerDetails) must be unnested and tied to the elements of the passengers array above. We do this via the where clause.<\/p>\n<div id=\"cb8\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true \">select l.booking.status,\r\n       i.daysOnboard,\r\n       p.passengerNumber,\r\n       pd.loyaltyId\r\nfrom lines l\r\nunnest l.itinerary i\r\nunnest i.passengers p\r\nunnest l.passengerDetails pd\r\nwhere p.passengerNumber = pd.passId\r\nlimit 2;<\/pre>\n<p>&nbsp;\n<\/p><\/div>\n<p>Query results:<\/p>\n<div id=\"cb9\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true \">[\r\n  {\r\n    \"status\": \"BOOKED\",\r\n    \"daysOnboard\": 1,\r\n    \"passengerNumber\": 1,\r\n    \"loyaltyId\": \"aaaabbbbccccdddd\"\r\n  },\r\n  {\r\n    \"status\": \"BOOKED\",\r\n    \"daysOnboard\": 1,\r\n    \"passengerNumber\": 2,\r\n    \"loyaltyId\": \"eeeeffffgggghhhh\"\r\n  }\r\n]<\/pre>\n<p>&nbsp;\n<\/p><\/div>\n<h4>Step 5 &#8211; Add remaining query elements<\/h4>\n<p>Other fields are required to complete the query. Note especially the _type field added to the where clause. In all likelihood in a production system, a bucket will contain documents of multiple types. Query results might be filtered in the query itself (as in the example below) or as part of the creation of the Analytics dataset.<\/p>\n<div id=\"cb10\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true \">select l.booking.status, l.booking.details.excursion.equipment, l.booking.details.excursion.line,\r\n       i.daysOnboard,\r\n       p.passengerNumber,\r\n       pd.loyaltyId, pd.programType.partnerId,\r\n       millis_to_str(l.booking.details.excursion.embarking*1000) embarking\r\nfrom lines l\r\nunnest l.itinerary i\r\nunnest i.passengers p\r\nunnest l.passengerDetails pd\r\nwhere p.passengerNumber = pd.passId\r\n  and l._type = \"booking\"\r\n  and str_to_millis(\"2019-07-12T19:00:00Z\") = l.booking.details.excursion.embarking*1000;<\/pre>\n<p>&nbsp;\n<\/p><\/div>\n<p>Query results:<\/p>\n<div id=\"cb11\" class=\"sourceCode\">\n<pre class=\"toolbar:2 toolbar-overlay:false toolbar-hide:false toolbar-delay:false show-title:false striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false show_mixed:false lang:default decode:true \">[\r\n  {\r\n    \"embarking\": \"2019-07-12T19:00:00Z\",\r\n    \"status\": \"BOOKED\",\r\n    \"equipment\": \"123X\",\r\n    \"line\": \"SRF\",\r\n    \"daysOnboard\": 1,\r\n    \"passengerNumber\": 1,\r\n    \"loyaltyId\": \"aaaabbbbccccdddd\",\r\n    \"partnerId\": 1\r\n  },\r\n  {\r\n    \"embarking\": \"2019-07-12T19:00:00Z\",\r\n    \"status\": \"BOOKED\",\r\n    \"equipment\": \"123X\",\r\n    \"line\": \"SRF\",\r\n    \"daysOnboard\": 1,\r\n    \"passengerNumber\": 2,\r\n    \"loyaltyId\": \"eeeeffffgggghhhh\"\r\n  }\r\n]<\/pre>\n<p>&nbsp;\n<\/p><\/div>\n<h4>Further reading<\/h4>\n<p>Unnest is a powerful feature of N1QL for Analytics, providing you with the means to master multiple embedded elements within your data. Further reading on its syntax can be found here: <a>https:\/\/docs.couchbase.com\/server\/6.0\/analytics\/3_query.html#Unnest_clauses<\/a><\/p>\n<p>A complete guide to N1QL for Analytics\u2013I\u2019m proud to own a signed copy of this one\u2013can be found here: <a>https:\/\/www.amazon.com\/SQL-Users-Tutorial-Don-Chamberlin\/dp\/0692184503\/<\/a><\/p>\n<h4>Try it out for yourself<\/h4>\n<p>Head straight to <a>https:\/\/docs.couchbase.com\/server\/6.0\/analytics\/quick-start.html#Using_docker<\/a> and get started right away with a Docker-based tutorial. Or if you prefer, download Couchbase Server 6 Enterprise from this page: <a>https:\/\/www.couchbase.com\/downloads<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In business applications, the data is often modeled for a large number of concurrent low latency queries. If you want to gain insight by looking at trends, however, you end up wishing you had an entirely different data model. The [&hellip;]<\/p>\n","protected":false},"author":41576,"featured_media":7263,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2294,1812],"tags":[1875,1861],"ppma_author":[9066],"class_list":["post-7262","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","category-n1ql-query","tag-arrays","tag-unnest"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Analytics - Love the Doc Model You\u2019re With - The Couchbase Blog<\/title>\n<meta name=\"description\" content=\"N1QL for Analytics allows for real-time analytics on data without altering the data model. Unnest and join multiple arrays and join with scalar fields.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/es\/analytics-love-the-doc-model-youre-with\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Analytics - Love the Doc Model You\u2019re With\" \/>\n<meta property=\"og:description\" content=\"N1QL for Analytics allows for real-time analytics on data without altering the data model. Unnest and join multiple arrays and join with scalar fields.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/analytics-love-the-doc-model-youre-with\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-26T19:17:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T00:22:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/07\/CouchbasePaddle.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1300\" \/>\n\t<meta property=\"og:image:height\" content=\"661\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Peter Reale\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Peter Reale\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/\"},\"author\":{\"name\":\"Peter Reale\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/391cf559b28ca6b4c1660a1ce283752c\"},\"headline\":\"Analytics &#8211; Love the Doc Model You\u2019re With\",\"datePublished\":\"2019-07-26T19:17:59+00:00\",\"dateModified\":\"2025-06-14T00:22:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/\"},\"wordCount\":794,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2019\\\/07\\\/CouchbasePaddle.jpg\",\"keywords\":[\"arrays\",\"unnest\"],\"articleSection\":[\"Couchbase Analytics\",\"SQL++ \\\/ N1QL Query\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/\",\"name\":\"Analytics - Love the Doc Model You\u2019re With - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2019\\\/07\\\/CouchbasePaddle.jpg\",\"datePublished\":\"2019-07-26T19:17:59+00:00\",\"dateModified\":\"2025-06-14T00:22:00+00:00\",\"description\":\"N1QL for Analytics allows for real-time analytics on data without altering the data model. Unnest and join multiple arrays and join with scalar fields.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2019\\\/07\\\/CouchbasePaddle.jpg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2019\\\/07\\\/CouchbasePaddle.jpg\",\"width\":1300,\"height\":661},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/analytics-love-the-doc-model-youre-with\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Analytics &#8211; Love the Doc Model You\u2019re With\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/391cf559b28ca6b4c1660a1ce283752c\",\"name\":\"Peter Reale\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/19012c1e7433fcde0d634a14a0f76610c40ce876b6c5a04b23d43c2181301761?s=96&d=mm&r=gec988e11a3058e02331c83244e993ea2\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/19012c1e7433fcde0d634a14a0f76610c40ce876b6c5a04b23d43c2181301761?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/19012c1e7433fcde0d634a14a0f76610c40ce876b6c5a04b23d43c2181301761?s=96&d=mm&r=g\",\"caption\":\"Peter Reale\"},\"description\":\"Peter Reale is a Senior Solutions Engineer at Couchbase and has been in the data business since 1984. He is based in Los Angeles.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/author\\\/peter-reale\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Analytics - Love the Doc Model You\u2019re With - The Couchbase Blog","description":"N1QL for Analytics permite realizar an\u00e1lisis de datos en tiempo real sin alterar el modelo de datos. Desanidar y unir m\u00faltiples matrices y unir con campos escalares.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/es\/analytics-love-the-doc-model-youre-with\/","og_locale":"es_MX","og_type":"article","og_title":"Analytics - Love the Doc Model You\u2019re With","og_description":"N1QL for Analytics allows for real-time analytics on data without altering the data model. Unnest and join multiple arrays and join with scalar fields.","og_url":"https:\/\/www.couchbase.com\/blog\/es\/analytics-love-the-doc-model-youre-with\/","og_site_name":"The Couchbase Blog","article_published_time":"2019-07-26T19:17:59+00:00","article_modified_time":"2025-06-14T00:22:00+00:00","og_image":[{"width":1300,"height":661,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/07\/CouchbasePaddle.jpg","type":"image\/jpeg"}],"author":"Peter Reale","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Peter Reale","Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/"},"author":{"name":"Peter Reale","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/391cf559b28ca6b4c1660a1ce283752c"},"headline":"Analytics &#8211; Love the Doc Model You\u2019re With","datePublished":"2019-07-26T19:17:59+00:00","dateModified":"2025-06-14T00:22:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/"},"wordCount":794,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/07\/CouchbasePaddle.jpg","keywords":["arrays","unnest"],"articleSection":["Couchbase Analytics","SQL++ \/ N1QL Query"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/","url":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/","name":"Analytics - Love the Doc Model You\u2019re With - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/07\/CouchbasePaddle.jpg","datePublished":"2019-07-26T19:17:59+00:00","dateModified":"2025-06-14T00:22:00+00:00","description":"N1QL for Analytics permite realizar an\u00e1lisis de datos en tiempo real sin alterar el modelo de datos. Desanidar y unir m\u00faltiples matrices y unir con campos escalares.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/07\/CouchbasePaddle.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/07\/CouchbasePaddle.jpg","width":1300,"height":661},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/analytics-love-the-doc-model-youre-with\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Analytics &#8211; Love the Doc Model You\u2019re With"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/391cf559b28ca6b4c1660a1ce283752c","name":"Peter Reale","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/19012c1e7433fcde0d634a14a0f76610c40ce876b6c5a04b23d43c2181301761?s=96&d=mm&r=gec988e11a3058e02331c83244e993ea2","url":"https:\/\/secure.gravatar.com\/avatar\/19012c1e7433fcde0d634a14a0f76610c40ce876b6c5a04b23d43c2181301761?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/19012c1e7433fcde0d634a14a0f76610c40ce876b6c5a04b23d43c2181301761?s=96&d=mm&r=g","caption":"Peter Reale"},"description":"Peter Reale is a Senior Solutions Engineer at Couchbase and has been in the data business since 1984. He is based in Los Angeles.","url":"https:\/\/www.couchbase.com\/blog\/es\/author\/peter-reale\/"}]}},"acf":[],"authors":[{"term_id":9066,"user_id":41576,"is_guest":0,"slug":"peter-reale","display_name":"Peter Reale","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/19012c1e7433fcde0d634a14a0f76610c40ce876b6c5a04b23d43c2181301761?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/7262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/41576"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=7262"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/7262\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/7263"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=7262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=7262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=7262"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=7262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}