SlideShare a Scribd company logo
Elasticsearch
What Is Elasticsearch?
Search index
Scalable
Distributed
Document-oriented
Built on Apache Lucene
What Isn’t Elasticsearch
Not a database
No security
No ACID compliance
No support for transactions
Near real-time data availability
Eventual consistency
Typical Architecture
Web application
Data access layer
RDBMS Elasticsearch
Who Uses Elasticsearch?
Simple REST API - GET
GET / {
"name": "Murmur",
"cluster_name": "elasticsearch",
"version": {
"number": "2.2.0",
"build_hash": "8ff36d139e16f8720f2947ef62c8167a888992fe",
"build_timestamp": "2016-01-27T13:32:39Z",
"build_snapshot": false,
"lucene_version": "5.4.1"
},
"tagline": "You Know, for Search"
}
Simple REST API - GET
GET /strutt/property/14523 {
"_index": "strutt",
"_type": "property",
"_id": "14523",
"_version": 1,
"found": true,
"_source": {
"name": "Newton Of Drumduan",
"public_date": "2016-03-20 12:31:31",
"property_address": "Newton Of Drumduan, Dess",
"property_town": "Aboyne",
"property_county": "Aberdeenshire",
"property_postcode": "AB34 5BD",
"property_price_min": 975000,
"property_price_display": "£ 975,000",
"property_features": [
"Garden",
"Rural",
"Outbuildings",
"Land/Paddock"
],
...
...
}
}
Simple REST API - POST
POST /strutt/property
{
"name" : "Mark's House",
"property_town" : "Lightwater",
"property_features" : [
"XBox One",
"Big TV",
"Big amp"
]
}
{
"_index": "strutt",
"_type": "property",
"_id": "AVQG5ihvhgvIo9hLVnu2",
"_version": 1,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true
}
Simple REST API - PUT
PUT /strutt/property/1234
{
"name" : "Mark's House",
"property_town" : "Lightwater",
"property_features" : [
"XBox One",
"Big TV",
"Big amp"
]
}
{
"_index": "strutt",
"_type": "property",
"_id": "1234",
"_version": 1,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true
}
Clever Things Elasticsearch Can Do
Full text search
Geolocation
Aggregations
Custom scoring
Combining elements
Full Text Search
GET /strutt/property/_search
{
"query" : {
"match": {
"property_long_description":
"underfloor heating"
}
}
}
{
"took": 5,
"hits": {
"total": 413,
"max_score": 0.94447553,
"hits": [
{
"_id": "15825",
"_score": 0.94447553,
"_source": {
"name": "Lower Sandhurst Road (Lot 1)",
"property_long_description": "Underfloor heating throughout
and Ambiente thermostats..."
}
},
{
"_id": "16783",
"_score": 0.92866411,
"_source": {
"name": "Eaton Place, London",
"property_long_description": "... including underfloor
heating, crestron lighting ..."
}
]
}
}
Geolocation - Filter By Distance
GET /strutt/office/_search
{
"query": {
"filtered": {
"filter": {
"bool": {
"filter": [
{
"geo_distance": {
"distance": "10miles",
"distance_type": "sloppy_arc",
"location": {
"lat": "51.41082",
"lon": "-0.67480"
}
}
}
]
}
}
}
}
}
Geolocation - Sort By Distance
GET /strutt/city/_search
{
"sort": [
{
"_geo_distance": {
"location": {
"lat": "45.850677",
"lon": "12.389420"
},
"order": "asc",
"unit": "miles",
"distance_type": "sloppy_arc"
}
}
],
"size": 25
}
Geolocation - Shape Search
GET /strutt/property/_search
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"geo_polygon": {
"location": {
"points": [
{
"lat": 51.381423948522,
"lon": -0.67402839660645
},
{
"lat": 51.379388252364,
"lon": -0.65703392028809
},
{
"lat": 51.370494412739,
"lon": -0.66338539123535
},
...
...
Aggregations
Extract data from Elastic results
Three types of aggregation
Metric
Bucket
Pipeline
Why?
Hugely powerful and FAST
GET /strutt/properties/_search
{
"aggregations": {
"average_price" : {
"avg": {
"field" : "price"
}
}
}
}
Aggregations - Some Examples
Metric Aggregations
Avg
Geo Bounds
Max/Min/Sum
Bucket Aggregations
Terms
Geo Distance
Range
GET /strutt/properties/_search
{
"aggregations": {
"grouped_by_town" : {
"terms" : { "field" : "town" },
"aggregations": {
"average_price" : {
"avg" : { "field" : "price" }
}
}
}
}
}
RESULTS
{
"grouped_by_town": {
"buckets": [{
"key": "Ascot",
"doc_count": 50,
"average_price": { "value": 75 }
}, {
"key": "Windsor",
"doc_count": 20,
"average_price": { "value": 145 }
}]
}
}
Nested Aggregations ?!?!
Custom Scoring
GET /strutt/article/_search
{
"query": {
"function_score": {
"query": {
"filtered": {
"filter": { "bool": { "must": [ { "term": { "parent_id": "3030" } } ] } }
}
},
"functions": [
{
"gauss": {
"public_date": {
"origin": "2016-04-12 09:00:07",
"scale": "150d",
"offset": "30d",
"decay": "0.1"
}
}
}
]
}
}
}
Combining Elements
GET /strutt/property/_search
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"property_available": 1
}
},
{
"range": {
"property_price_max": {
"gte": "1000000"
}
}
},
{
"range": {
"property_price_min": {
"lte": "5000000"
}
}
},
Combining Elements
{
"geo_polygon": {
"location": {
"points": [
{
"lat": 51.39963404311,
"lon": -0.68990707397461
},
{
"lat": 51.393636224206,
"lon": -0.64115524291992
},
{
"lat": 51.368351060511,
"lon": -0.63600540161133
},
{
"lat": 51.371351725538,
"lon": -0.68750381469727
}
]
}
}
},
Combining Elements
{
"range": {
"property_bedrooms": {
"gte": "5"
}
}
},
{
"bool": {
"should": [
{
"term": {
"property_class": "Residential sales"
}
}
]
}
},
Combining Elements
{
"bool": {
"should": [
{
"term": {
"property_features": "Swimming Pool"
}
}
]
}
}
],
"filter": [
{
"geo_distance": {
"distance": "10miles",
"distance_type": "sloppy_arc",
"location": {
"lat": "51.41082",
"lon": "-0.67480"
}
}
}
]
}
Combining Elements
"sort": [
{
"_geo_distance": {
"location": {
"lat": "51.41082",
"lon": "-0.67480"
},
"order": "asc",
"unit": "miles",
"distance_type": "sloppy_arc"
}
},
{
"property_price_min": {
"order": "desc"
}
}
],
"from": 0,
"size": 10000
}
Did I Mention It’s Fast?
{
"took": 12,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": null,
"hits": [
...
...
And There’s More...
Automatic clustering
Explaining query results
Suggesters
Spelling corrections and fuzzy matching
Match highlighting
Term boosting
Query profiling
Cluster management and monitoring
Learn more about Rawnet

More Related Content

PPTX
MongoDB Scalability Best Practices
PPTX
MongoDB Chunks - Distribution, Splitting, and Merging
PDF
Managing Data and Operation Distribution In MongoDB
PPTX
Triggers In MongoDB
PDF
Elasticsearch War Stories
PPTX
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
ODP
Elastic Search
PDF
GitConnect
MongoDB Scalability Best Practices
MongoDB Chunks - Distribution, Splitting, and Merging
Managing Data and Operation Distribution In MongoDB
Triggers In MongoDB
Elasticsearch War Stories
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
Elastic Search
GitConnect

What's hot (10)

PDF
MongoDB World 2016: The Best IoT Analytics with MongoDB
PPTX
Presentation
PPTX
MongoDB - Sharded Cluster Tutorial
PDF
Real-time Data Analytics mit Elasticsearch
PPTX
Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Goo...
PPTX
2015.03 - The RDF Validator - A Tool to Validate RDF Data (KIM)
PPTX
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
PPTX
PistonHead's use of MongoDB for Analytics
PPTX
Dapper performance
PDF
GDG İstanbul Şubat Etkinliği - Sunum
MongoDB World 2016: The Best IoT Analytics with MongoDB
Presentation
MongoDB - Sharded Cluster Tutorial
Real-time Data Analytics mit Elasticsearch
Sydney Python Presentation (Feb 2010) - Tracking Large Metallic Objects / Goo...
2015.03 - The RDF Validator - A Tool to Validate RDF Data (KIM)
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
PistonHead's use of MongoDB for Analytics
Dapper performance
GDG İstanbul Şubat Etkinliği - Sunum
Ad

Viewers also liked (20)

PDF
4byte As Number Migration Suggestion
PDF
Noisy information transmission through molecular interaction networks
PDF
Rawnet Lightning Talk - 'What is an idea & how do you create them?'
PPT
Toward The Semantic Deep Web
PPTX
FEGTS IP Training - Network Diagnostic Introduction
PPT
Network and TCP performance relationship workshop
PDF
Rawnet Lightning Talk - Design Inspiration
PPT
Web 101 by Jennifer Lill
PDF
Botnets & DDoS Introduction
PPT
4 byte AS number workshop material
PPTX
Rawnet Lightning talk - 'A Day in the Life of an Account Manager'
PPTX
How internet works and how messages are transferred in Internet
PPTX
A review of Concrete 5 and what is new in version 5.7
PDF
How To Process And Solve Network Security In ISP
PDF
4 Byte As Ns Test Scenarios
PPTX
Rawnet Lightning Talk - Web Components
PDF
Rawnet Lightning Talk - Anyone Can Draw.
PDF
20th TWNIC OPM IPv6 Support by SDN & NFV
PPT
CDN and ISP Operation
PPT
Network Design in Cloud-ready IDC
4byte As Number Migration Suggestion
Noisy information transmission through molecular interaction networks
Rawnet Lightning Talk - 'What is an idea & how do you create them?'
Toward The Semantic Deep Web
FEGTS IP Training - Network Diagnostic Introduction
Network and TCP performance relationship workshop
Rawnet Lightning Talk - Design Inspiration
Web 101 by Jennifer Lill
Botnets & DDoS Introduction
4 byte AS number workshop material
Rawnet Lightning talk - 'A Day in the Life of an Account Manager'
How internet works and how messages are transferred in Internet
A review of Concrete 5 and what is new in version 5.7
How To Process And Solve Network Security In ISP
4 Byte As Ns Test Scenarios
Rawnet Lightning Talk - Web Components
Rawnet Lightning Talk - Anyone Can Draw.
20th TWNIC OPM IPv6 Support by SDN & NFV
CDN and ISP Operation
Network Design in Cloud-ready IDC
Ad

Similar to Rawnet Lightning Talk - Elasticsearch (20)

PPTX
ElasticSearch - DevNexus Atlanta - 2014
PDF
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
PDF
Introduction to Elasticsearch
PDF
ElasticSearch on AWS - Real Estate portal case study (Spitogatos.gr)
PDF
Simple search with elastic search
PDF
Elasto Mania
PDF
Elasticsearch, a distributed search engine with real-time analytics
PPTX
Elasticsearch
ODP
Elasticsearch for beginners
PPTX
Practical Use of a NoSQL Database
PDF
Elasticsearch Quick Introduction
PPTX
Webinar: Getting Started with MongoDB - Back to Basics
PDF
Practical Use of a NoSQL
PPTX
Elastic search Walkthrough
PPTX
ElasticSearch AJUG 2013
PPTX
ElasticSearch Basic Introduction
PPTX
Elastic pivorak
PPTX
PDF
Elasticsearch Introduction at BigData meetup
PDF
The Power of Elasticsearch
ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
Introduction to Elasticsearch
ElasticSearch on AWS - Real Estate portal case study (Spitogatos.gr)
Simple search with elastic search
Elasto Mania
Elasticsearch, a distributed search engine with real-time analytics
Elasticsearch
Elasticsearch for beginners
Practical Use of a NoSQL Database
Elasticsearch Quick Introduction
Webinar: Getting Started with MongoDB - Back to Basics
Practical Use of a NoSQL
Elastic search Walkthrough
ElasticSearch AJUG 2013
ElasticSearch Basic Introduction
Elastic pivorak
Elasticsearch Introduction at BigData meetup
The Power of Elasticsearch

Recently uploaded (20)

PPTX
artificial intelligence overview of it and more
PDF
Testing WebRTC applications at scale.pdf
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPTX
Funds Management Learning Material for Beg
DOCX
Unit-3 cyber security network security of internet system
PDF
Sims 4 Historia para lo sims 4 para jugar
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPTX
E -tech empowerment technologies PowerPoint
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
Introduction to the IoT system, how the IoT system works
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPTX
innovation process that make everything different.pptx
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
artificial intelligence overview of it and more
Testing WebRTC applications at scale.pdf
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Funds Management Learning Material for Beg
Unit-3 cyber security network security of internet system
Sims 4 Historia para lo sims 4 para jugar
Design_with_Watersergyerge45hrbgre4top (1).ppt
Tenda Login Guide: Access Your Router in 5 Easy Steps
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
introduction about ICD -10 & ICD-11 ppt.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
The Internet -By the Numbers, Sri Lanka Edition
Decoding a Decade: 10 Years of Applied CTI Discipline
E -tech empowerment technologies PowerPoint
Introuction about ICD -10 and ICD-11 PPT.pptx
Job_Card_System_Styled_lorem_ipsum_.pptx
Introduction to the IoT system, how the IoT system works
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
innovation process that make everything different.pptx
An introduction to the IFRS (ISSB) Stndards.pdf

Rawnet Lightning Talk - Elasticsearch

  • 2. What Is Elasticsearch? Search index Scalable Distributed Document-oriented Built on Apache Lucene
  • 3. What Isn’t Elasticsearch Not a database No security No ACID compliance No support for transactions Near real-time data availability Eventual consistency
  • 4. Typical Architecture Web application Data access layer RDBMS Elasticsearch
  • 6. Simple REST API - GET GET / { "name": "Murmur", "cluster_name": "elasticsearch", "version": { "number": "2.2.0", "build_hash": "8ff36d139e16f8720f2947ef62c8167a888992fe", "build_timestamp": "2016-01-27T13:32:39Z", "build_snapshot": false, "lucene_version": "5.4.1" }, "tagline": "You Know, for Search" }
  • 7. Simple REST API - GET GET /strutt/property/14523 { "_index": "strutt", "_type": "property", "_id": "14523", "_version": 1, "found": true, "_source": { "name": "Newton Of Drumduan", "public_date": "2016-03-20 12:31:31", "property_address": "Newton Of Drumduan, Dess", "property_town": "Aboyne", "property_county": "Aberdeenshire", "property_postcode": "AB34 5BD", "property_price_min": 975000, "property_price_display": "£ 975,000", "property_features": [ "Garden", "Rural", "Outbuildings", "Land/Paddock" ], ... ... } }
  • 8. Simple REST API - POST POST /strutt/property { "name" : "Mark's House", "property_town" : "Lightwater", "property_features" : [ "XBox One", "Big TV", "Big amp" ] } { "_index": "strutt", "_type": "property", "_id": "AVQG5ihvhgvIo9hLVnu2", "_version": 1, "_shards": { "total": 2, "successful": 1, "failed": 0 }, "created": true }
  • 9. Simple REST API - PUT PUT /strutt/property/1234 { "name" : "Mark's House", "property_town" : "Lightwater", "property_features" : [ "XBox One", "Big TV", "Big amp" ] } { "_index": "strutt", "_type": "property", "_id": "1234", "_version": 1, "_shards": { "total": 2, "successful": 1, "failed": 0 }, "created": true }
  • 10. Clever Things Elasticsearch Can Do Full text search Geolocation Aggregations Custom scoring Combining elements
  • 11. Full Text Search GET /strutt/property/_search { "query" : { "match": { "property_long_description": "underfloor heating" } } } { "took": 5, "hits": { "total": 413, "max_score": 0.94447553, "hits": [ { "_id": "15825", "_score": 0.94447553, "_source": { "name": "Lower Sandhurst Road (Lot 1)", "property_long_description": "Underfloor heating throughout and Ambiente thermostats..." } }, { "_id": "16783", "_score": 0.92866411, "_source": { "name": "Eaton Place, London", "property_long_description": "... including underfloor heating, crestron lighting ..." } ] } }
  • 12. Geolocation - Filter By Distance GET /strutt/office/_search { "query": { "filtered": { "filter": { "bool": { "filter": [ { "geo_distance": { "distance": "10miles", "distance_type": "sloppy_arc", "location": { "lat": "51.41082", "lon": "-0.67480" } } } ] } } } } }
  • 13. Geolocation - Sort By Distance GET /strutt/city/_search { "sort": [ { "_geo_distance": { "location": { "lat": "45.850677", "lon": "12.389420" }, "order": "asc", "unit": "miles", "distance_type": "sloppy_arc" } } ], "size": 25 }
  • 14. Geolocation - Shape Search GET /strutt/property/_search { "query": { "filtered": { "filter": { "bool": { "must": [ { "geo_polygon": { "location": { "points": [ { "lat": 51.381423948522, "lon": -0.67402839660645 }, { "lat": 51.379388252364, "lon": -0.65703392028809 }, { "lat": 51.370494412739, "lon": -0.66338539123535 }, ... ...
  • 15. Aggregations Extract data from Elastic results Three types of aggregation Metric Bucket Pipeline Why? Hugely powerful and FAST GET /strutt/properties/_search { "aggregations": { "average_price" : { "avg": { "field" : "price" } } } }
  • 16. Aggregations - Some Examples Metric Aggregations Avg Geo Bounds Max/Min/Sum Bucket Aggregations Terms Geo Distance Range
  • 17. GET /strutt/properties/_search { "aggregations": { "grouped_by_town" : { "terms" : { "field" : "town" }, "aggregations": { "average_price" : { "avg" : { "field" : "price" } } } } } } RESULTS { "grouped_by_town": { "buckets": [{ "key": "Ascot", "doc_count": 50, "average_price": { "value": 75 } }, { "key": "Windsor", "doc_count": 20, "average_price": { "value": 145 } }] } } Nested Aggregations ?!?!
  • 18. Custom Scoring GET /strutt/article/_search { "query": { "function_score": { "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "parent_id": "3030" } } ] } } } }, "functions": [ { "gauss": { "public_date": { "origin": "2016-04-12 09:00:07", "scale": "150d", "offset": "30d", "decay": "0.1" } } } ] } } }
  • 19. Combining Elements GET /strutt/property/_search { "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "property_available": 1 } }, { "range": { "property_price_max": { "gte": "1000000" } } }, { "range": { "property_price_min": { "lte": "5000000" } } },
  • 20. Combining Elements { "geo_polygon": { "location": { "points": [ { "lat": 51.39963404311, "lon": -0.68990707397461 }, { "lat": 51.393636224206, "lon": -0.64115524291992 }, { "lat": 51.368351060511, "lon": -0.63600540161133 }, { "lat": 51.371351725538, "lon": -0.68750381469727 } ] } } },
  • 21. Combining Elements { "range": { "property_bedrooms": { "gte": "5" } } }, { "bool": { "should": [ { "term": { "property_class": "Residential sales" } } ] } },
  • 22. Combining Elements { "bool": { "should": [ { "term": { "property_features": "Swimming Pool" } } ] } } ], "filter": [ { "geo_distance": { "distance": "10miles", "distance_type": "sloppy_arc", "location": { "lat": "51.41082", "lon": "-0.67480" } } } ] }
  • 23. Combining Elements "sort": [ { "_geo_distance": { "location": { "lat": "51.41082", "lon": "-0.67480" }, "order": "asc", "unit": "miles", "distance_type": "sloppy_arc" } }, { "property_price_min": { "order": "desc" } } ], "from": 0, "size": 10000 }
  • 24. Did I Mention It’s Fast? { "took": 12, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 3, "max_score": null, "hits": [ ... ...
  • 25. And There’s More... Automatic clustering Explaining query results Suggesters Spelling corrections and fuzzy matching Match highlighting Term boosting Query profiling Cluster management and monitoring

Editor's Notes

  • #2: Look at how we make decisions Automatic processes evolved over millenia Not always right - optimised for survival Learn to be aware of when they may be wrong