{"id":3029,"date":"2019-11-03T13:46:49","date_gmt":"2019-11-03T13:46:49","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=3029"},"modified":"2023-07-19T11:52:56","modified_gmt":"2023-07-19T11:52:56","slug":"aggregations-in-elasticsearch","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/","title":{"rendered":"Aggregations In ElasticSearch:"},"content":{"rendered":"<p>One of the most powerful features by ElasticSearch outside of full-text searches. ElasticSearch does aggregations much faster than RDBMS and this is why It is considered as a Big Player in Big data Analytics. we use the \u201c<strong>aggs\u201d<\/strong> component to perform aggregations.<br \/>\nExample:<\/p>\n<p>here we are specifying aggregation name \u201cpopular_cars\u201d inside \u201caggs\u201d component. We are grouping documents by the \u201cmake\u201d field. It will return different buckets as per your aggregation criteria are shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3030\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png\" alt=\"\" width=\"850\" height=\"495\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png 340w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss-300x175.png 300w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/p>\n<ul>\n<li><u>Multiple Aggregations inside \u201caggs\u201d<\/u><\/li>\n<\/ul>\n<p>We can have multiple aggregations within one \u201caggs\u201d component shown below. popular_cars, avg_price, max_price, min_price are the different aggregations performed here.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3031\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multiple-aggs.png\" alt=\"\" width=\"850\" height=\"790\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multiple-aggs.png 340w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multiple-aggs-300x279.png 300w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/p>\n<ul>\n<li><u>Aggregation within an Aggregation<\/u><\/li>\n<\/ul>\n<p>We can have nested aggregations shown below.<br \/>\nHere we will be using the \u201c<strong>stats<\/strong>\u201d clause inside an aggregation price of distinct cars. \u201cstats\u201d will return avg, min, max, a sum of price field.<\/p>\n<p>Notice that we are implementing nested \u201caggs\u201d here. here popular_cars is an aggregation based on making field and inside that, we are creating one more aggregation which is stats_price.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3032\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggs_output.png\" alt=\"\" width=\"850\" height=\"1493\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggs_output.png 283w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggs_output-171x300.png 171w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the most powerful features by ElasticSearch outside of full-text searches. ElasticSearch does aggregations much faster than RDBMS and this is why It is considered as a Big Player in Big data Analytics. we use the \u201caggs\u201d component to perform aggregations. Example: here we are specifying aggregation name \u201cpopular_cars\u201d inside \u201caggs\u201d component. We are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57,1702],"tags":[],"class_list":["post-3029","post","type-post","status-publish","format-standard","hentry","category-elastic-search","category-elasticsearch-modules"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Aggregations In ElasticSearch: - Prwatech<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Aggregations In ElasticSearch: - Prwatech\" \/>\n<meta property=\"og:description\" content=\"One of the most powerful features by ElasticSearch outside of full-text searches. ElasticSearch does aggregations much faster than RDBMS and this is why It is considered as a Big Player in Big data Analytics. we use the \u201caggs\u201d component to perform aggregations. Example: here we are specifying aggregation name \u201cpopular_cars\u201d inside \u201caggs\u201d component. We are [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/\" \/>\n<meta property=\"og:site_name\" content=\"Prwatech\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prwatech.in\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-03T13:46:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-19T11:52:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png\" \/>\n<meta name=\"author\" content=\"Prwatech\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:site\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prwatech\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/\",\"url\":\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/\",\"name\":\"Aggregations In ElasticSearch: - Prwatech\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png\",\"datePublished\":\"2019-11-03T13:46:49+00:00\",\"dateModified\":\"2023-07-19T11:52:56+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#primaryimage\",\"url\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png\",\"contentUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png\",\"width\":340,\"height\":198},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Aggregations In ElasticSearch:\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/prwatech.in\/blog\/#website\",\"url\":\"https:\/\/prwatech.in\/blog\/\",\"name\":\"Prwatech\",\"description\":\"Share Ideas, Start Something Good.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/prwatech.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\",\"name\":\"Prwatech\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"caption\":\"Prwatech\"},\"url\":\"https:\/\/prwatech.in\/blog\/author\/prwatech123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Aggregations In ElasticSearch: - Prwatech","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Aggregations In ElasticSearch: - Prwatech","og_description":"One of the most powerful features by ElasticSearch outside of full-text searches. ElasticSearch does aggregations much faster than RDBMS and this is why It is considered as a Big Player in Big data Analytics. we use the \u201caggs\u201d component to perform aggregations. Example: here we are specifying aggregation name \u201cpopular_cars\u201d inside \u201caggs\u201d component. We are [&hellip;]","og_url":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2019-11-03T13:46:49+00:00","article_modified_time":"2023-07-19T11:52:56+00:00","og_image":[{"url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png","type":"","width":"","height":""}],"author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/","url":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/","name":"Aggregations In ElasticSearch: - Prwatech","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#primaryimage"},"image":{"@id":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#primaryimage"},"thumbnailUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png","datePublished":"2019-11-03T13:46:49+00:00","dateModified":"2023-07-19T11:52:56+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#primaryimage","url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png","contentUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/aggssss.png","width":340,"height":198},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/elastic-search\/elasticsearch-modules\/aggregations-in-elasticsearch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Aggregations In ElasticSearch:"}]},{"@type":"WebSite","@id":"https:\/\/prwatech.in\/blog\/#website","url":"https:\/\/prwatech.in\/blog\/","name":"Prwatech","description":"Share Ideas, Start Something Good.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/prwatech.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3","name":"Prwatech","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","caption":"Prwatech"},"url":"https:\/\/prwatech.in\/blog\/author\/prwatech123\/"}]}},"_links":{"self":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/3029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/comments?post=3029"}],"version-history":[{"count":5,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/3029\/revisions"}],"predecessor-version":[{"id":3817,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/3029\/revisions\/3817"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=3029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=3029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=3029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}