SlideShare a Scribd company logo
Elasticsearch
Getting Started Part 3
Aggregations
Suyog Kale
Kloojj.com
Kloojj.com
Suyog Dilip Kale
Technology Evangelist
Chief Architect
www.kloojj.com
Organiser
Pune Developer’s Community
www.meetup.com/Pune-Developers-Community
http://www.punedevscommunity.in/
Kloojj.com
● Aggregations
○ What is aggregations in Elasticsearch?
○ Metrics aggregations
■ Avg aggregation
■ Cardinality aggregation
■ Extended stats aggregation
■ Min & Max aggregation
■ Sum aggregation
○ Bucket aggregations
○ Nested Bucket aggregations
Kloojj.com
● Read-What is aggregations in Elasticsearch
○ Aggregations helps provide aggregated data based on a search query.
○ It can be composed in order to build complex summaries of the data.
○ There are many different types of aggregations, each with its own
purpose and output.
○ Elasticsearch aggregations let you zoom out to explore trends and
patterns in your data.
○ What if your ecommerce portal has billions of user visits and you
want drill down it by country, states and then cities? What if you want
to see avg user age groups OR gender wise product interests ? What if
you want calculate daily, weekly or monthly sales ?
○ Everything is much easy with Elasticsearch aggregations
Kloojj.com
● Read-Metrics aggregations
○ Metrics Aggregations are used to compute metrics over set of
documents. Numeric matrices are either single-valued like average
aggregation or multi-valued like stats.
○ Avg aggregations: to get the average of any numeric field present in
the aggregated documents, see below example:
GET /website/user/_search
{
"aggs": {
"avg_score": {
"avg": {
"field": "score"
}
}
}
}
Kloojj.com
● Read-Metrics aggregations
○ Cardinality aggregations: to get the count of distinct values of a
particular field, see below example:
GET /website/user/_search
{
"aggs": {
"cardinality_cname": {
"cardinality": {
"field": "cname"
}
}
}
}
○ This will give you distinct country name count.
Kloojj.com
● Read-Metrics aggregations
○ Extended stats aggregations: it generates all the statistics about a
specific numerical field in aggregated documents, for example:
GET /website/user/_search
{
"aggs": {
"stats_score": {
"stats": {
"field": "score"
}
}
}
}
○ It will return all statistics on score field like total records,minimum,
maximum, average and total sum value.
Kloojj.com
● Read-Metrics aggregations
○ Min & Max aggregations: These aggregations can be used to find the
max or min value of a specific numeric field in aggregated documents.
For example below one returns max value from score field:
GET /website/user/_search
{
"aggs": {
"max_score": {
"max": {
"field": "score"
}
}
}
}
Kloojj.com
● Read-Metrics aggregations
○ Sum aggregation: This aggregation calculates the sum of a specific
numeric field in aggregated documents. For example:
GET /website/user/_search
{
"aggs": {
"total_score": {
"sum": {
"field": "score"
}
}
}
}
○ This returns the total of score value
Kloojj.com
● Read-Bucket aggregations
○ These aggregations contain many buckets for different types of
aggregations having a criterion, which determines whether a
document belongs to that bucket or not.
○ There are many other special bucket aggregations, those are −
● Date Histogram Aggregation
● Date Range Aggregation
● Filter Aggregation
● Filters Aggregation
● Geo Distance Aggregation
● GeoHash grid Aggregation
● Global Aggregation
● Histogram Aggregation
● IPv4 Range Aggregation
● Missing Aggregation
● Nested Aggregation
● Range Aggregation
● Reverse nested Aggregation
● Sampler Aggregation
● Significant Terms Aggregation
● Terms Aggregation
Kloojj.com
● Read-Bucket aggregations
○ Let’s try term bucket aggregation
GET /website/user/_search
{
"aggs": {
"by_cname": {
"terms": {
"field": "cname"
}
}
}
}
○ If you see the result it will return the document counts for each
country found in aggregated documents
Kloojj.com
● Read-Nested Bucket aggregations
○ To drill down the aggregation results, it is best way to nest them, for
example, if you want to get counts against each action by country try
below query:
GET /website/user/_search
{
"aggs": {
"by_cname": {
"terms": {
"field": "cname"
},
"aggs": {
"by_action": {
"terms": {
"field": "action"
}
}
}
}
}
}
Kloojj.com
Suyog Dilip Kale
Email suyog.kale@gmail.com
Twitter @suyog_kale
Thank You !!!

More Related Content

What's hot

Exploring Large Chemical Data Sets
Exploring Large Chemical Data SetsExploring Large Chemical Data Sets
Exploring Large Chemical Data Sets
kylelutz
 
Let's downscale the semantic web !
Let's downscale the semantic web !Let's downscale the semantic web !
Let's downscale the semantic web !
Christophe Guéret
 
Exposing the data from NARCIS with VIVO
Exposing the data from NARCIS with VIVOExposing the data from NARCIS with VIVO
Exposing the data from NARCIS with VIVO
Christophe Guéret
 
Publishing XBRL as Linked Open Data
Publishing XBRL as Linked Open DataPublishing XBRL as Linked Open Data
Publishing XBRL as Linked Open Data
Roberto García
 
computer full forms
computer full formscomputer full forms
computer full forms
RAMDALAI Bhargav
 
Data Skipping Technology
Data Skipping TechnologyData Skipping Technology
Data Skipping Technology
Big Data Value Association
 
PhD Projects in Green Cloud Computing Research Guidance
PhD Projects in Green Cloud Computing Research GuidancePhD Projects in Green Cloud Computing Research Guidance
PhD Projects in Green Cloud Computing Research Guidance
PhD Services
 
First Step in NoSql
First Step in NoSqlFirst Step in NoSql
First Step in NoSql
Delwar Hossain
 
Big data Europe: concept, platform and pilots
Big data Europe: concept, platform and pilotsBig data Europe: concept, platform and pilots
Big data Europe: concept, platform and pilots
BigData_Europe
 
DMA Ignite Night - Status DMA
DMA Ignite Night - Status DMADMA Ignite Night - Status DMA
DMA Ignite Night - Status DMA
Data Market Austria
 

What's hot (11)

Exploring Large Chemical Data Sets
Exploring Large Chemical Data SetsExploring Large Chemical Data Sets
Exploring Large Chemical Data Sets
 
Let's downscale the semantic web !
Let's downscale the semantic web !Let's downscale the semantic web !
Let's downscale the semantic web !
 
Exposing the data from NARCIS with VIVO
Exposing the data from NARCIS with VIVOExposing the data from NARCIS with VIVO
Exposing the data from NARCIS with VIVO
 
Publishing XBRL as Linked Open Data
Publishing XBRL as Linked Open DataPublishing XBRL as Linked Open Data
Publishing XBRL as Linked Open Data
 
computer full forms
computer full formscomputer full forms
computer full forms
 
Data Skipping Technology
Data Skipping TechnologyData Skipping Technology
Data Skipping Technology
 
PhD Projects in Green Cloud Computing Research Guidance
PhD Projects in Green Cloud Computing Research GuidancePhD Projects in Green Cloud Computing Research Guidance
PhD Projects in Green Cloud Computing Research Guidance
 
First Step in NoSql
First Step in NoSqlFirst Step in NoSql
First Step in NoSql
 
Big data Europe: concept, platform and pilots
Big data Europe: concept, platform and pilotsBig data Europe: concept, platform and pilots
Big data Europe: concept, platform and pilots
 
Ajax
Ajax Ajax
Ajax
 
DMA Ignite Night - Status DMA
DMA Ignite Night - Status DMADMA Ignite Night - Status DMA
DMA Ignite Night - Status DMA
 

Similar to Elasticsearch: Getting Started Part 3 Aggregations

Elasticsearch for Data Analytics
Elasticsearch for Data AnalyticsElasticsearch for Data Analytics
Elasticsearch for Data Analytics
Felipe
 
All about aggregations
All about aggregationsAll about aggregations
All about aggregations
Fan Robbin
 
Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"
John Sobanski
 
Big Query - Women Techmarkers (Ukraine - March 2014)
Big Query - Women Techmarkers (Ukraine - March 2014)Big Query - Women Techmarkers (Ukraine - March 2014)
Big Query - Women Techmarkers (Ukraine - March 2014)
Ido Green
 
Logging and ranting / Vytis Valentinavičius (Lamoda)
Logging and ranting / Vytis Valentinavičius (Lamoda)Logging and ranting / Vytis Valentinavičius (Lamoda)
Logging and ranting / Vytis Valentinavičius (Lamoda)
Ontico
 
Precog & MongoDB User Group: Skyrocket Your Analytics
Precog & MongoDB User Group: Skyrocket Your Analytics Precog & MongoDB User Group: Skyrocket Your Analytics
Precog & MongoDB User Group: Skyrocket Your Analytics
MongoDB
 
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
South Tyrol Free Software Conference
 
Elasticsearch speed is key
Elasticsearch speed is keyElasticsearch speed is key
Elasticsearch speed is key
Enterprise Search Warsaw Meetup
 
OSMC 2014: Introduction into collectd | Florian Foster
OSMC 2014: Introduction into collectd | Florian FosterOSMC 2014: Introduction into collectd | Florian Foster
OSMC 2014: Introduction into collectd | Florian Foster
NETWAYS
 
Building an Observability platform with ClickHouse
Building an Observability platform with ClickHouseBuilding an Observability platform with ClickHouse
Building an Observability platform with ClickHouse
Altinity Ltd
 
PCU@RISE 2017 - Building a thesaurus for product search
PCU@RISE 2017 - Building a thesaurus for product searchPCU@RISE 2017 - Building a thesaurus for product search
PCU@RISE 2017 - Building a thesaurus for product search
PCU Consortium
 
Nosql part3
Nosql part3Nosql part3
Nosql part3
Ruru Chowdhury
 
PCU@RISE 2017 - Building a thesaurus for product search
PCU@RISE 2017 - Building a thesaurus for product searchPCU@RISE 2017 - Building a thesaurus for product search
PCU@RISE 2017 - Building a thesaurus for product search
Marc Dutoo
 
Elasticsearch for Data Engineers
Elasticsearch for Data EngineersElasticsearch for Data Engineers
Elasticsearch for Data Engineers
Duy Do
 
Smart solutions for productivity gain IQA conference 2017
Smart solutions for productivity gain   IQA conference 2017Smart solutions for productivity gain   IQA conference 2017
Smart solutions for productivity gain IQA conference 2017
Steve Franklin
 
Redis Day TLV 2018 - RediSearch Aggregations
Redis Day TLV 2018 - RediSearch AggregationsRedis Day TLV 2018 - RediSearch Aggregations
Redis Day TLV 2018 - RediSearch Aggregations
Redis Labs
 
MongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced AggregationMongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced Aggregation
Joe Drumgoole
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
Jason Terpko
 
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
NETWAYS
 
Big Query Basics
Big Query BasicsBig Query Basics
Big Query Basics
Ido Green
 

Similar to Elasticsearch: Getting Started Part 3 Aggregations (20)

Elasticsearch for Data Analytics
Elasticsearch for Data AnalyticsElasticsearch for Data Analytics
Elasticsearch for Data Analytics
 
All about aggregations
All about aggregationsAll about aggregations
All about aggregations
 
Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"
 
Big Query - Women Techmarkers (Ukraine - March 2014)
Big Query - Women Techmarkers (Ukraine - March 2014)Big Query - Women Techmarkers (Ukraine - March 2014)
Big Query - Women Techmarkers (Ukraine - March 2014)
 
Logging and ranting / Vytis Valentinavičius (Lamoda)
Logging and ranting / Vytis Valentinavičius (Lamoda)Logging and ranting / Vytis Valentinavičius (Lamoda)
Logging and ranting / Vytis Valentinavičius (Lamoda)
 
Precog & MongoDB User Group: Skyrocket Your Analytics
Precog & MongoDB User Group: Skyrocket Your Analytics Precog & MongoDB User Group: Skyrocket Your Analytics
Precog & MongoDB User Group: Skyrocket Your Analytics
 
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
 
Elasticsearch speed is key
Elasticsearch speed is keyElasticsearch speed is key
Elasticsearch speed is key
 
OSMC 2014: Introduction into collectd | Florian Foster
OSMC 2014: Introduction into collectd | Florian FosterOSMC 2014: Introduction into collectd | Florian Foster
OSMC 2014: Introduction into collectd | Florian Foster
 
Building an Observability platform with ClickHouse
Building an Observability platform with ClickHouseBuilding an Observability platform with ClickHouse
Building an Observability platform with ClickHouse
 
PCU@RISE 2017 - Building a thesaurus for product search
PCU@RISE 2017 - Building a thesaurus for product searchPCU@RISE 2017 - Building a thesaurus for product search
PCU@RISE 2017 - Building a thesaurus for product search
 
Nosql part3
Nosql part3Nosql part3
Nosql part3
 
PCU@RISE 2017 - Building a thesaurus for product search
PCU@RISE 2017 - Building a thesaurus for product searchPCU@RISE 2017 - Building a thesaurus for product search
PCU@RISE 2017 - Building a thesaurus for product search
 
Elasticsearch for Data Engineers
Elasticsearch for Data EngineersElasticsearch for Data Engineers
Elasticsearch for Data Engineers
 
Smart solutions for productivity gain IQA conference 2017
Smart solutions for productivity gain   IQA conference 2017Smart solutions for productivity gain   IQA conference 2017
Smart solutions for productivity gain IQA conference 2017
 
Redis Day TLV 2018 - RediSearch Aggregations
Redis Day TLV 2018 - RediSearch AggregationsRedis Day TLV 2018 - RediSearch Aggregations
Redis Day TLV 2018 - RediSearch Aggregations
 
MongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced AggregationMongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced Aggregation
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
 
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
 
Big Query Basics
Big Query BasicsBig Query Basics
Big Query Basics
 

Recently uploaded

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 

Recently uploaded (20)

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 

Elasticsearch: Getting Started Part 3 Aggregations

  • 1. Elasticsearch Getting Started Part 3 Aggregations Suyog Kale Kloojj.com
  • 2. Kloojj.com Suyog Dilip Kale Technology Evangelist Chief Architect www.kloojj.com Organiser Pune Developer’s Community www.meetup.com/Pune-Developers-Community http://www.punedevscommunity.in/
  • 3. Kloojj.com ● Aggregations ○ What is aggregations in Elasticsearch? ○ Metrics aggregations ■ Avg aggregation ■ Cardinality aggregation ■ Extended stats aggregation ■ Min & Max aggregation ■ Sum aggregation ○ Bucket aggregations ○ Nested Bucket aggregations
  • 4. Kloojj.com ● Read-What is aggregations in Elasticsearch ○ Aggregations helps provide aggregated data based on a search query. ○ It can be composed in order to build complex summaries of the data. ○ There are many different types of aggregations, each with its own purpose and output. ○ Elasticsearch aggregations let you zoom out to explore trends and patterns in your data. ○ What if your ecommerce portal has billions of user visits and you want drill down it by country, states and then cities? What if you want to see avg user age groups OR gender wise product interests ? What if you want calculate daily, weekly or monthly sales ? ○ Everything is much easy with Elasticsearch aggregations
  • 5. Kloojj.com ● Read-Metrics aggregations ○ Metrics Aggregations are used to compute metrics over set of documents. Numeric matrices are either single-valued like average aggregation or multi-valued like stats. ○ Avg aggregations: to get the average of any numeric field present in the aggregated documents, see below example: GET /website/user/_search { "aggs": { "avg_score": { "avg": { "field": "score" } } } }
  • 6. Kloojj.com ● Read-Metrics aggregations ○ Cardinality aggregations: to get the count of distinct values of a particular field, see below example: GET /website/user/_search { "aggs": { "cardinality_cname": { "cardinality": { "field": "cname" } } } } ○ This will give you distinct country name count.
  • 7. Kloojj.com ● Read-Metrics aggregations ○ Extended stats aggregations: it generates all the statistics about a specific numerical field in aggregated documents, for example: GET /website/user/_search { "aggs": { "stats_score": { "stats": { "field": "score" } } } } ○ It will return all statistics on score field like total records,minimum, maximum, average and total sum value.
  • 8. Kloojj.com ● Read-Metrics aggregations ○ Min & Max aggregations: These aggregations can be used to find the max or min value of a specific numeric field in aggregated documents. For example below one returns max value from score field: GET /website/user/_search { "aggs": { "max_score": { "max": { "field": "score" } } } }
  • 9. Kloojj.com ● Read-Metrics aggregations ○ Sum aggregation: This aggregation calculates the sum of a specific numeric field in aggregated documents. For example: GET /website/user/_search { "aggs": { "total_score": { "sum": { "field": "score" } } } } ○ This returns the total of score value
  • 10. Kloojj.com ● Read-Bucket aggregations ○ These aggregations contain many buckets for different types of aggregations having a criterion, which determines whether a document belongs to that bucket or not. ○ There are many other special bucket aggregations, those are − ● Date Histogram Aggregation ● Date Range Aggregation ● Filter Aggregation ● Filters Aggregation ● Geo Distance Aggregation ● GeoHash grid Aggregation ● Global Aggregation ● Histogram Aggregation ● IPv4 Range Aggregation ● Missing Aggregation ● Nested Aggregation ● Range Aggregation ● Reverse nested Aggregation ● Sampler Aggregation ● Significant Terms Aggregation ● Terms Aggregation
  • 11. Kloojj.com ● Read-Bucket aggregations ○ Let’s try term bucket aggregation GET /website/user/_search { "aggs": { "by_cname": { "terms": { "field": "cname" } } } } ○ If you see the result it will return the document counts for each country found in aggregated documents
  • 12. Kloojj.com ● Read-Nested Bucket aggregations ○ To drill down the aggregation results, it is best way to nest them, for example, if you want to get counts against each action by country try below query: GET /website/user/_search { "aggs": { "by_cname": { "terms": { "field": "cname" }, "aggs": { "by_action": { "terms": { "field": "action" } } } } } }
  • 13. Kloojj.com Suyog Dilip Kale Email suyog.kale@gmail.com Twitter @suyog_kale Thank You !!!