SlideShare uma empresa Scribd logo
1 de 22
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
Introduction to Aggregations
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
facets (elasticsearch < 1.0)
facets
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
out-of-the-box facets
(elasticsearch < 1.0)
• terms
• range
• histogram / date histogram
• filter/query
• statistical
• geo distance
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
terms facet
• Divides documents into buckets based on a value
of a selected term
• Calculates statistics on some other field of these
document for each bucket
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
index of large US cities
{
"rank": "21",
"city": "Boston",
"state": "MA",
"population2012": "636479",
"population2010": "617594",
"land_area": "48.277",
"density": "12793",
"ansi": "619463",
"location": {
"lat": "42.332",
"lon": "71.0202"
}
}
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
example: terms facet request
$ curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{
"facets": {
"stat1": {
"terms_stats": {
"key_field": "state",
"value_field": "density"
}
}
}
}'
group by
this field
calculate stats
for this field
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
example: terms facet response
"facets" : {
"stat1" : {
"_type" : "terms_stats",
"missing" : 0,
"terms" : [ {
"term" : "CA",
"count" : 69,
"total_count" : 69,
"min" : 1442.0,
"max" : 17179.0,
"total" : 383545.0,
"mean" : 5558.623188405797
}, {
"term" : "TX",
"count" : 32,
"total_count" : 32,
"min" : 1096.0,
"max" : 3974.0,
"total" : 79892.0,
"mean" : 2496.625
}, {
"term" : "FL",
"count" : 20,
"total_count" : 20,
"min" : 1100.0,
"max" : 11136.0,
"total" : 80132.0,
group by
field
stats
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
example: range facet request
curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{
"facets": {
"population_ranges": {
"histogram": {
"key_field": "population2012",
"value_field": "density",
"interval": 500000
}
}
}
}'
group by
this field
calculate stats
by this field
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
example: terms facet response
"facets" : {
"population_ranges" : {
"_type" : "histogram",
"entries" : [ {
"key" : 0,
"count" : 255,
"min" : 171.0,
"max" : 17346.0,
"total" : 980306.0,
"total_count" : 252,
"mean" : 3890.1031746031745
}, {
"key" : 500000,
"count" : 25,
"min" : 956.0,
"max" : 17179.0,
"total" : 116597.0,
"total_count" : 25,
"mean" : 4663.88
}, {
"key" : 1000000,
"count" : 4,
"min" : 2798.0,
"max" : 4020.0,
"total" : 13216.0,
"total_count" : 4,
"mean" : 3304.0
group by
field (population)
stats
(density)
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
nt an average density by population histogram
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
aggregations
Buckets Calculators
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
aggregations = buckets + calculators
CA
TX
MA
CO
AZ
"facets" : {
"population_ranges" : {
"_type" : "histogram",
"entries" : [ {
"key" : 0,
"count" : 255,
"min" : 171.0,
"max" : 17346.0,
"total" : 980306.0,
"total_count" : 252,
"mean" : 3890.1031746031745
}, {
"key" : 500000,
"count" : 25,
"min" : 956.0,
"max" : 17179.0,
"total" : 116597.0,
"total_count" : 25,
"mean" : 4663.88
}, {
"key" : 1000000,
"count" : 4,
"min" : 2798.0,
"max" : 4020.0,
"total" : 13216.0,
"total_count" : 4,
"mean" : 3304.0
}, {
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
aggregations = buckets + calculators
CA
TX
MA
CO
AZ
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
example: density by state aggregation
$ curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{
"aggs" : {
"mean_density_by_state" : {
"terms" : {
"field" : "state"
},
"aggs": {
"mean_density": {
"avg" : {
"field" : "density"
}
}
}
}
}
}'
group by
this field
calculate stats
for this field
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
aggregation response
"aggregations" : {
"mean_density_by_state" : {
"terms" : [ {
"term" : "CA",
"doc_count" : 69,
"mean_density" : {
"value" : 5558.623188405797
}
}, {
"term" : "TX",
"doc_count" : 32,
"mean_density" : {
"value" : 2496.625
}
}, {
"term" : "FL",
"doc_count" : 20,
"mean_density" : {
"value" : 4006.6
}
}, {
"term" : "CO",
"doc_count" : 11,
"mean_density" : {
"value" : 2944.4
}
}, {
group by
state
density stats
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
example: density by population aggregation
$ curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{
"aggs" : {
"mean_density_by_population" : {
"histogram" : {
"field" : "population2012",
"interval": 500000
},
"aggs": {
"mean_density": {
"avg" : {
"field" : "density"
}
}
}
}
}
}'
group by
population
calculate stats
density
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
aggregation response
"aggregations" : {
"mean_density_by_population" : [ {
"key" : 0,
"doc_count" : 255,
"mean_density" : {
"value" : 3890.1031746031745
}
}, {
"key" : 500000,
"doc_count" : 25,
"mean_density" : {
"value" : 4663.88
}
}, {
"key" : 1000000,
"doc_count" : 4,
"mean_density" : {
"value" : 3304.0
}
}, {
"key" : 1500000,
"doc_count" : 1,
"mean_density" : {
"value" : 11379.0
}
group by
population
density stats
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
example: density by population by state
$ curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{
"aggs" : {
"mean_density_by_population_by_state": {
"terms" : { "field" : "state" },
"aggs": {
"mean_density_by_population" : {
"histogram" : {
"field" : "population2012",
"interval": 500000
},
"aggs": {
"mean_density": {
"avg" : {
"field" : "density"
}
}
}
}
}
}
}
}'
group by
population
calculate stats
on density
group by
state
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
aggregation response"aggregations" : {
"mean_density_by_population_by_state" : {
"terms" : [ {
"term" : "CA",
"doc_count" : 69,
"mean_density_by_population" : [ {
"key" : 0,
"doc_count" : 64,
"mean_density" : {
"value" : 5382.453125
}
}, {
"key" : 500000,
"doc_count" : 3,
"mean_density" : {
"value" : 8985.333333333334
}
}, {
"key" : 1000000,
"doc_count" : 1,
"mean_density" : {
"value" : 4020.0
}
}, {
"key" : 3500000,
"doc_count" : 1,
"mean_density" : {
"value" : 8092.0
}
} ]
}, {
"term" : "TX",
"doc_count" : 32,
"mean_density_by_population" : [ {
"key" : 0,
"doc_count" : 26,
"mean_density" : {
"value" : 2408.3076923076924
group by
population
stats on density
group by state
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
out-of-the-box aggregation calculators
(elasticsearch >= 1.0)
• avg
• min
• max
• sum
• count
• stats
• extended stats
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
out-of-the-box aggregation bucketizers
(elasticsearch >= 1.0)
• global
• filter
• missing
• terms
• range
• date range
• ip range
• histogram
• date histogram
• geo distance
• nested
Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly
aggregations 2.0 (aka bucket reducers)
(elasticsearch 2.0)
apply arbitrary functions on buckets
• first derivative
• second derivative
• exponential weighted moving average
• outlier detection

Mais conteúdo relacionado

Mais procurados

Elasticsearch - DevNexus 2015
Elasticsearch - DevNexus 2015Elasticsearch - DevNexus 2015
Elasticsearch - DevNexus 2015Roy Russo
 
Introduction to elasticsearch
Introduction to elasticsearchIntroduction to elasticsearch
Introduction to elasticsearchFlorian Hopf
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to ElasticsearchJason Austin
 
Simple search with elastic search
Simple search with elastic searchSimple search with elastic search
Simple search with elastic searchmarkstory
 
Elasticsearch War Stories
Elasticsearch War StoriesElasticsearch War Stories
Elasticsearch War StoriesArno Broekhof
 
Intro to Elasticsearch
Intro to ElasticsearchIntro to Elasticsearch
Intro to ElasticsearchClifford James
 
ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch - DevNexus Atlanta - 2014ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch - DevNexus Atlanta - 2014Roy Russo
 
Java clients for elasticsearch
Java clients for elasticsearchJava clients for elasticsearch
Java clients for elasticsearchFlorian Hopf
 
Elasticsearch quick Intro (English)
Elasticsearch quick Intro (English)Elasticsearch quick Intro (English)
Elasticsearch quick Intro (English)Federico Panini
 
Joins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation EnhancementsJoins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation EnhancementsAndrew Morgan
 
Elasticsearch - under the hood
Elasticsearch - under the hoodElasticsearch - under the hood
Elasticsearch - under the hoodSmartCat
 
Elasticsearch presentation 1
Elasticsearch presentation 1Elasticsearch presentation 1
Elasticsearch presentation 1Maruf Hassan
 
Elastic search overview
Elastic search overviewElastic search overview
Elastic search overviewABC Talks
 
ElasticSearch in action
ElasticSearch in actionElasticSearch in action
ElasticSearch in actionCodemotion
 
Use Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorUse Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorMaxim Shelest
 
Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseAlexandre Rafalovitch
 

Mais procurados (20)

Elasticsearch 5.0
Elasticsearch 5.0Elasticsearch 5.0
Elasticsearch 5.0
 
Elasticsearch - DevNexus 2015
Elasticsearch - DevNexus 2015Elasticsearch - DevNexus 2015
Elasticsearch - DevNexus 2015
 
Introduction to elasticsearch
Introduction to elasticsearchIntroduction to elasticsearch
Introduction to elasticsearch
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 
Simple search with elastic search
Simple search with elastic searchSimple search with elastic search
Simple search with elastic search
 
Elasticsearch War Stories
Elasticsearch War StoriesElasticsearch War Stories
Elasticsearch War Stories
 
Intro to Elasticsearch
Intro to ElasticsearchIntro to Elasticsearch
Intro to Elasticsearch
 
ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch - DevNexus Atlanta - 2014ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch - DevNexus Atlanta - 2014
 
Java clients for elasticsearch
Java clients for elasticsearchJava clients for elasticsearch
Java clients for elasticsearch
 
Elasticsearch quick Intro (English)
Elasticsearch quick Intro (English)Elasticsearch quick Intro (English)
Elasticsearch quick Intro (English)
 
Joins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation EnhancementsJoins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation Enhancements
 
Elasticsearch - under the hood
Elasticsearch - under the hoodElasticsearch - under the hood
Elasticsearch - under the hood
 
Elasticsearch presentation 1
Elasticsearch presentation 1Elasticsearch presentation 1
Elasticsearch presentation 1
 
Elastic search overview
Elastic search overviewElastic search overview
Elastic search overview
 
Elasticsearch Introduction at BigData meetup
Elasticsearch Introduction at BigData meetupElasticsearch Introduction at BigData meetup
Elasticsearch Introduction at BigData meetup
 
ElasticSearch in action
ElasticSearch in actionElasticSearch in action
ElasticSearch in action
 
Use Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorUse Cases for Elastic Search Percolator
Use Cases for Elastic Search Percolator
 
Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by Case
 
Elasticsearch Introduction
Elasticsearch IntroductionElasticsearch Introduction
Elasticsearch Introduction
 

Destaque

Elasticsearch Data Analyses
Elasticsearch Data AnalysesElasticsearch Data Analyses
Elasticsearch Data AnalysesAlaa Elhadba
 
Elasticsearch Aggregations
Elasticsearch AggregationsElasticsearch Aggregations
Elasticsearch AggregationsWaldemar Neto
 
What's new in Elasticsearch v5
What's new in Elasticsearch v5What's new in Elasticsearch v5
What's new in Elasticsearch v5Idan Tohami
 
Elasticsearch Introduction to Data model, Search & Aggregations
Elasticsearch Introduction to Data model, Search & AggregationsElasticsearch Introduction to Data model, Search & Aggregations
Elasticsearch Introduction to Data model, Search & AggregationsAlaa Elhadba
 
TDC2016POA | Trilha BigData - Respostas em tempo real para perguntas complexa...
TDC2016POA | Trilha BigData - Respostas em tempo real para perguntas complexa...TDC2016POA | Trilha BigData - Respostas em tempo real para perguntas complexa...
TDC2016POA | Trilha BigData - Respostas em tempo real para perguntas complexa...tdc-globalcode
 
Migrating from monolithic rails
Migrating from monolithic railsMigrating from monolithic rails
Migrating from monolithic railsDanielius Visockas
 
Influence of micropolar lubricant on bearings performance a review(2)
Influence of micropolar lubricant on bearings performance a review(2)Influence of micropolar lubricant on bearings performance a review(2)
Influence of micropolar lubricant on bearings performance a review(2)susheelpote
 
Professional dj & dance floor setup
Professional dj & dance floor setupProfessional dj & dance floor setup
Professional dj & dance floor setupkayum1
 
How did you attract/address your audience?
How did you attract/address your audience?How did you attract/address your audience?
How did you attract/address your audience?Charlotte Power
 
Norme de-aplicare a Legii 142/1998 privind tichetele de masa
Norme de-aplicare a Legii 142/1998 privind tichetele de masaNorme de-aplicare a Legii 142/1998 privind tichetele de masa
Norme de-aplicare a Legii 142/1998 privind tichetele de masaCityConta.ro
 
NOSANN IT Scope of Services
NOSANN IT Scope of ServicesNOSANN IT Scope of Services
NOSANN IT Scope of ServicesMahmoud Abdullah
 

Destaque (16)

Elasticsearch Data Analyses
Elasticsearch Data AnalysesElasticsearch Data Analyses
Elasticsearch Data Analyses
 
Elasticsearch Aggregations
Elasticsearch AggregationsElasticsearch Aggregations
Elasticsearch Aggregations
 
What's new in Elasticsearch v5
What's new in Elasticsearch v5What's new in Elasticsearch v5
What's new in Elasticsearch v5
 
Elasticsearch Introduction to Data model, Search & Aggregations
Elasticsearch Introduction to Data model, Search & AggregationsElasticsearch Introduction to Data model, Search & Aggregations
Elasticsearch Introduction to Data model, Search & Aggregations
 
TDC2016POA | Trilha BigData - Respostas em tempo real para perguntas complexa...
TDC2016POA | Trilha BigData - Respostas em tempo real para perguntas complexa...TDC2016POA | Trilha BigData - Respostas em tempo real para perguntas complexa...
TDC2016POA | Trilha BigData - Respostas em tempo real para perguntas complexa...
 
Migrating from monolithic rails
Migrating from monolithic railsMigrating from monolithic rails
Migrating from monolithic rails
 
Influence of micropolar lubricant on bearings performance a review(2)
Influence of micropolar lubricant on bearings performance a review(2)Influence of micropolar lubricant on bearings performance a review(2)
Influence of micropolar lubricant on bearings performance a review(2)
 
Teekait may 16
Teekait may 16Teekait may 16
Teekait may 16
 
Professional dj & dance floor setup
Professional dj & dance floor setupProfessional dj & dance floor setup
Professional dj & dance floor setup
 
GIOVANNI.DALLACQUA.RESUME
GIOVANNI.DALLACQUA.RESUMEGIOVANNI.DALLACQUA.RESUME
GIOVANNI.DALLACQUA.RESUME
 
How did you attract/address your audience?
How did you attract/address your audience?How did you attract/address your audience?
How did you attract/address your audience?
 
NOSANN Profile
NOSANN ProfileNOSANN Profile
NOSANN Profile
 
Norme de-aplicare a Legii 142/1998 privind tichetele de masa
Norme de-aplicare a Legii 142/1998 privind tichetele de masaNorme de-aplicare a Legii 142/1998 privind tichetele de masa
Norme de-aplicare a Legii 142/1998 privind tichetele de masa
 
SUMTI CV
SUMTI CVSUMTI CV
SUMTI CV
 
моє захоплення
моє захопленнямоє захоплення
моє захоплення
 
NOSANN IT Scope of Services
NOSANN IT Scope of ServicesNOSANN IT Scope of Services
NOSANN IT Scope of Services
 

Semelhante a ElasticSearch - Introduction to Aggregations

Hopper Elasticsearch Hackathon
Hopper Elasticsearch HackathonHopper Elasticsearch Hackathon
Hopper Elasticsearch Hackathonimotov
 
Elasticsearch Quick Introduction
Elasticsearch Quick IntroductionElasticsearch Quick Introduction
Elasticsearch Quick Introductionimotov
 
Webinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkWebinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkMongoDB
 
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB
 
Elasticsearch: You know, for search! and more!
Elasticsearch: You know, for search! and more!Elasticsearch: You know, for search! and more!
Elasticsearch: You know, for search! and more!Philips Kokoh Prasetyo
 
ELK - What's new and showcases
ELK - What's new and showcasesELK - What's new and showcases
ELK - What's new and showcasesAndrii Gakhov
 
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Keshav Murthy
 
Montreal Elasticsearch Meetup
Montreal Elasticsearch MeetupMontreal Elasticsearch Meetup
Montreal Elasticsearch MeetupLoïc Bertron
 
Mongo db query docuement
Mongo db query docuementMongo db query docuement
Mongo db query docuementzarigatongy
 
How we (Almost) Forgot Lambda Architecture and used Elasticsearch
How we (Almost) Forgot Lambda Architecture and used ElasticsearchHow we (Almost) Forgot Lambda Architecture and used Elasticsearch
How we (Almost) Forgot Lambda Architecture and used ElasticsearchMichael Stockerl
 
Academy PRO: Elasticsearch Misc
Academy PRO: Elasticsearch MiscAcademy PRO: Elasticsearch Misc
Academy PRO: Elasticsearch MiscBinary Studio
 
Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...EDB
 
Elasticsearch in 15 minutes
Elasticsearch in 15 minutesElasticsearch in 15 minutes
Elasticsearch in 15 minutesDavid Pilato
 
Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.Keshav Murthy
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB
 
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...MongoDB
 
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...Codemotion
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用LearningTech
 

Semelhante a ElasticSearch - Introduction to Aggregations (20)

Hopper Elasticsearch Hackathon
Hopper Elasticsearch HackathonHopper Elasticsearch Hackathon
Hopper Elasticsearch Hackathon
 
Elasticsearch Quick Introduction
Elasticsearch Quick IntroductionElasticsearch Quick Introduction
Elasticsearch Quick Introduction
 
Webinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkWebinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation Framework
 
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
 
Elasticsearch: You know, for search! and more!
Elasticsearch: You know, for search! and more!Elasticsearch: You know, for search! and more!
Elasticsearch: You know, for search! and more!
 
Talk MongoDB - Amil
Talk MongoDB - AmilTalk MongoDB - Amil
Talk MongoDB - Amil
 
ELK - What's new and showcases
ELK - What's new and showcasesELK - What's new and showcases
ELK - What's new and showcases
 
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
 
Montreal Elasticsearch Meetup
Montreal Elasticsearch MeetupMontreal Elasticsearch Meetup
Montreal Elasticsearch Meetup
 
Mongo db query docuement
Mongo db query docuementMongo db query docuement
Mongo db query docuement
 
How we (Almost) Forgot Lambda Architecture and used Elasticsearch
How we (Almost) Forgot Lambda Architecture and used ElasticsearchHow we (Almost) Forgot Lambda Architecture and used Elasticsearch
How we (Almost) Forgot Lambda Architecture and used Elasticsearch
 
Academy PRO: Elasticsearch Misc
Academy PRO: Elasticsearch MiscAcademy PRO: Elasticsearch Misc
Academy PRO: Elasticsearch Misc
 
Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...
 
Elasticsearch in 15 minutes
Elasticsearch in 15 minutesElasticsearch in 15 minutes
Elasticsearch in 15 minutes
 
Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
 
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
 
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
 

Mais de enterprisesearchmeetup

Mais de enterprisesearchmeetup (6)

Cisco meetup-25 april2017
Cisco meetup-25 april2017Cisco meetup-25 april2017
Cisco meetup-25 april2017
 
Algolia - Hosted Search API
Algolia - Hosted Search API Algolia - Hosted Search API
Algolia - Hosted Search API
 
The Elastic ELK Stack
The Elastic ELK StackThe Elastic ELK Stack
The Elastic ELK Stack
 
Relevancy and Search Quality Analysis - Search Technologies
Relevancy and Search Quality Analysis - Search TechnologiesRelevancy and Search Quality Analysis - Search Technologies
Relevancy and Search Quality Analysis - Search Technologies
 
Scalable Search Analytics
Scalable Search AnalyticsScalable Search Analytics
Scalable Search Analytics
 
Practical Relevance Measurement
Practical Relevance MeasurementPractical Relevance Measurement
Practical Relevance Measurement
 

Último

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

ElasticSearch - Introduction to Aggregations

  • 1. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly Introduction to Aggregations
  • 2. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly facets (elasticsearch < 1.0) facets
  • 3. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly out-of-the-box facets (elasticsearch < 1.0) • terms • range • histogram / date histogram • filter/query • statistical • geo distance
  • 4. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly terms facet • Divides documents into buckets based on a value of a selected term • Calculates statistics on some other field of these document for each bucket
  • 5. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly index of large US cities { "rank": "21", "city": "Boston", "state": "MA", "population2012": "636479", "population2010": "617594", "land_area": "48.277", "density": "12793", "ansi": "619463", "location": { "lat": "42.332", "lon": "71.0202" } }
  • 6. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly example: terms facet request $ curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{ "facets": { "stat1": { "terms_stats": { "key_field": "state", "value_field": "density" } } } }' group by this field calculate stats for this field
  • 7. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly example: terms facet response "facets" : { "stat1" : { "_type" : "terms_stats", "missing" : 0, "terms" : [ { "term" : "CA", "count" : 69, "total_count" : 69, "min" : 1442.0, "max" : 17179.0, "total" : 383545.0, "mean" : 5558.623188405797 }, { "term" : "TX", "count" : 32, "total_count" : 32, "min" : 1096.0, "max" : 3974.0, "total" : 79892.0, "mean" : 2496.625 }, { "term" : "FL", "count" : 20, "total_count" : 20, "min" : 1100.0, "max" : 11136.0, "total" : 80132.0, group by field stats
  • 8. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly example: range facet request curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{ "facets": { "population_ranges": { "histogram": { "key_field": "population2012", "value_field": "density", "interval": 500000 } } } }' group by this field calculate stats by this field
  • 9. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly example: terms facet response "facets" : { "population_ranges" : { "_type" : "histogram", "entries" : [ { "key" : 0, "count" : 255, "min" : 171.0, "max" : 17346.0, "total" : 980306.0, "total_count" : 252, "mean" : 3890.1031746031745 }, { "key" : 500000, "count" : 25, "min" : 956.0, "max" : 17179.0, "total" : 116597.0, "total_count" : 25, "mean" : 4663.88 }, { "key" : 1000000, "count" : 4, "min" : 2798.0, "max" : 4020.0, "total" : 13216.0, "total_count" : 4, "mean" : 3304.0 group by field (population) stats (density)
  • 10. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly nt an average density by population histogram
  • 11. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly aggregations Buckets Calculators
  • 12. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly aggregations = buckets + calculators CA TX MA CO AZ "facets" : { "population_ranges" : { "_type" : "histogram", "entries" : [ { "key" : 0, "count" : 255, "min" : 171.0, "max" : 17346.0, "total" : 980306.0, "total_count" : 252, "mean" : 3890.1031746031745 }, { "key" : 500000, "count" : 25, "min" : 956.0, "max" : 17179.0, "total" : 116597.0, "total_count" : 25, "mean" : 4663.88 }, { "key" : 1000000, "count" : 4, "min" : 2798.0, "max" : 4020.0, "total" : 13216.0, "total_count" : 4, "mean" : 3304.0 }, {
  • 13. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly aggregations = buckets + calculators CA TX MA CO AZ
  • 14. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly example: density by state aggregation $ curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{ "aggs" : { "mean_density_by_state" : { "terms" : { "field" : "state" }, "aggs": { "mean_density": { "avg" : { "field" : "density" } } } } } }' group by this field calculate stats for this field
  • 15. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly aggregation response "aggregations" : { "mean_density_by_state" : { "terms" : [ { "term" : "CA", "doc_count" : 69, "mean_density" : { "value" : 5558.623188405797 } }, { "term" : "TX", "doc_count" : 32, "mean_density" : { "value" : 2496.625 } }, { "term" : "FL", "doc_count" : 20, "mean_density" : { "value" : 4006.6 } }, { "term" : "CO", "doc_count" : 11, "mean_density" : { "value" : 2944.4 } }, { group by state density stats
  • 16. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly example: density by population aggregation $ curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{ "aggs" : { "mean_density_by_population" : { "histogram" : { "field" : "population2012", "interval": 500000 }, "aggs": { "mean_density": { "avg" : { "field" : "density" } } } } } }' group by population calculate stats density
  • 17. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly aggregation response "aggregations" : { "mean_density_by_population" : [ { "key" : 0, "doc_count" : 255, "mean_density" : { "value" : 3890.1031746031745 } }, { "key" : 500000, "doc_count" : 25, "mean_density" : { "value" : 4663.88 } }, { "key" : 1000000, "doc_count" : 4, "mean_density" : { "value" : 3304.0 } }, { "key" : 1500000, "doc_count" : 1, "mean_density" : { "value" : 11379.0 } group by population density stats
  • 18. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly example: density by population by state $ curl -XGET "localhost:9200/test-data/cities/_search?pretty" -d '{ "aggs" : { "mean_density_by_population_by_state": { "terms" : { "field" : "state" }, "aggs": { "mean_density_by_population" : { "histogram" : { "field" : "population2012", "interval": 500000 }, "aggs": { "mean_density": { "avg" : { "field" : "density" } } } } } } } }' group by population calculate stats on density group by state
  • 19. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly aggregation response"aggregations" : { "mean_density_by_population_by_state" : { "terms" : [ { "term" : "CA", "doc_count" : 69, "mean_density_by_population" : [ { "key" : 0, "doc_count" : 64, "mean_density" : { "value" : 5382.453125 } }, { "key" : 500000, "doc_count" : 3, "mean_density" : { "value" : 8985.333333333334 } }, { "key" : 1000000, "doc_count" : 1, "mean_density" : { "value" : 4020.0 } }, { "key" : 3500000, "doc_count" : 1, "mean_density" : { "value" : 8092.0 } } ] }, { "term" : "TX", "doc_count" : 32, "mean_density_by_population" : [ { "key" : 0, "doc_count" : 26, "mean_density" : { "value" : 2408.3076923076924 group by population stats on density group by state
  • 20. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly out-of-the-box aggregation calculators (elasticsearch >= 1.0) • avg • min • max • sum • count • stats • extended stats
  • 21. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly out-of-the-box aggregation bucketizers (elasticsearch >= 1.0) • global • filter • missing • terms • range • date range • ip range • histogram • date histogram • geo distance • nested
  • 22. Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly aggregations 2.0 (aka bucket reducers) (elasticsearch 2.0) apply arbitrary functions on buckets • first derivative • second derivative • exponential weighted moving average • outlier detection