SlideShare a Scribd company logo
Introduction to
Elasticsearch
Jason Austin - @jason_austin
The Problem
• You are building a website to find beers
• You have a huge database of beers and
breweries to sift through
• You want simple keyword-based searching
• You also want structured searching, like finding
all beers > 7% ABV
• You want to run some analytics on what beers
are in your dataset
Enter Elasticsearch
• Lucene based
• Distributed
• Fast
• RESTful interface
• Document-Based with JSON
Introduction to Elasticsearch
Install Elasticsearch
• Download from http://elasticsearch.org
• Requires Java to run
Run Elasticsearch
• From the install directory:
./bin/elasticsearch -d!
!
http://localhost:9200/!
Communicating
• Elasticsearch listens to RESTful HTTP
requests
• GET, POST, PUT, DELETE
• CURL works just fine
ES Structure
Relational DB
Databases
Tables
Rows
Columns
Elasticsearch
Indices
Types
Documents
Fields
ES Structure
Elasticsearch
Indices
Types
Documents
Fields
Elasticsearch
phpbeer
beer
Pliny the Elder
ABV, Name, Desc
Create an Index
curl -XPOST 'http://localhost:9200/phpbeer'
What to Search?
• Define the types of things to search
• Beer
• Brewery - Maybe later
Define a Beer
• Name
• Style
• ABV
• Brewery
‣ Name
‣ City
Beer JSON
{

! "name": "Pliny the Elder",

! "style": "Imperial India Pale Ale",

! "abv": 7.0,

! "brewery": {

! ! "name": "Russian River Brewing Co.",

! ! "city": "Santa Rosa",

"state": "California"

! }

}

SavingThe Beer
curl -XPOST 'http://localhost:9200/
phpbeer/beer/1' -d '{

! "name": "Pliny the Elder",

! "style": "Imperial India Pale Ale",

! "abv": 7.0,

! "brewery": {

! ! "name": "Russian River Brewing Co.",

! ! "city": "Santa Rosa",

"state": "California"

! }

}'

Getting a beer
curl -XGET 'http://localhost:9200/phpbeer/
beer/1?pretty'
Updating a Beer
curl -XPOST 'http://localhost:9200/
phpbeer/beer/1' -d '{

! "name": "Pliny the Elder",

! "style": "Imperial India Pale Ale",

! "abv": 8.0,

! "brewery": {

! ! "name": "Russian River Brewing Co.",

! ! "city": "Santa Rosa",

"state": "California"

! }

}'

POSTvs PUT
• POST
• No ID - Creates new doc, assigns ID
• With ID - Updates or creates new doc
• PUT
• No ID - Error
• With ID - Updates doc
Delete a Beer
curl -XDELETE 'http://localhost:9200/
phpbeer/beer/1'
Finally! Searching!
curl -XGET 'http://localhost:9200/_search?
pretty&q=pliny'
Specific Field Searching
curl -XGET 'http://localhost:9200/_search?
pretty&q=style:pliny'!
curl -XGET 'http://localhost:9200/_search?
pretty&q=style:imperial'
Alternate Approach
• Search using DSL (Domain Specific
Language)
• JSON in request body
DSL Searching
curl -XGET 'http://localhost:9200/_search?
pretty' -d '{

"query" : {

"match" : {

"style" : "imperial"

}

}

}'
DSL = Query + Filter
• Query - “How well does the document
match”
• Filter - Yes or No question on the field
Query DSL
• match
• Used to query across all fields for a string
• match_phrase
• Used to query an exact phrase
• match_all
• Matches all documents
• multi_match
• Runs the same match query on multiple fields
Filter DSL
• term
• Exact match on a field
• range
• Match numbers over a specified range
• exists / missing
• Match based on the existence of a value
for a field
More Complex Search
• Find beer whose styles include “Pale
Ale” that are less than 7% ABV
Match + Range
curl -XGET 'http://localhost:9200/_search?pretty'
-d '{

"query" : {

"match" : {

"style" : "pale ale"

}

},

"filter" : {

"range" : {

"abv" : { "lt" : 7 }

}

}

}'
Embedded Field Search
curl -XGET 'http://localhost:9200/_search?pretty'
-d '{

"query" : {

"match" : {

"brewery.state" : "California"

}

}

}'
Highlighting Search Results
Highlighting Search Results
curl -XGET 'http://localhost:9200/_search?pretty'
-d '{

"query" : {

"match" : {

"style" : "pale ale"

}

},

"highlight": {

"fields" : {

"style" : {}

}

}

}'
Aggregations
• Collect analytics on your documents
• 2 main types
• Bucketing
• Produce a set of buckets with documents
in them
• Metric
• Compute metrics over a set of documents
Bucketing Aggregations
Metric Aggregations
• How many beers exist of each style?
• What is the average ABV of beers for
each style?
• How many beers exist that are brewed
in California?
What is the average ABV of beers for each style?
curl -XGET 'http://localhost:9200/_search?pretty' -d '{

"aggs" : {

"all_beers" : {

"terms" : { "field" : "style" },

"aggs" : {

"avg_abv" : {

"avg" : { "field" : "abv" }

}

}

}

}

}'
Mappings
• Define how ES searches
• Completely optional
• Must re-index after defining mapping
Create Index with Mapping
curl -XPOST localhost:9200/phpbeer -d '{

"mappings" : {

"beer" : {

"_source" : { "enabled" : true },

"properties" : {

"style" : { 

"type" : "string", 

"index" : "not_analyzed" 

}

}

}

}

}'
curl -XDELETE localhost:9200/phpbeer
What is the average ABV of beers for each style?
curl -XGET 'http://localhost:9200/_search?pretty' -d '{

"aggs" : {

"all_beers" : {

"terms" : { "field" : "style" },

"aggs" : {

"avg_abv" : {

"avg" : { "field" : "abv" }

}

}

}

}

}'
Non-Analyzed Fields
curl -XGET 'http://localhost:9200/_search?
pretty&q=style:imperial'!
curl -XGET 'http://localhost:9200/_search?
pretty&q=style:hefeweizen'
Flexibility
• Mixing aggregations, filters and queries
all together
• What beers have the word “night” in
the name that are between 4 and 6 %
ABV, broken down by style.
Elasticsearch and PHP
• Elasticsearch PHP Lib

https://github.com/elasticsearch/elasticsearch-php
• Elastica

http://elastica.io/
Other Awesome ES Features
• Search analyzers
• Geo-based searching
• Elasticsearch Plugins
• kopf - http://localhost:9200/_plugin/kopf
Questions?
• @jason_austin
• http://www.pintlabs.com
• https://joind.in/10821

More Related Content

What's hot (20)

PDF
ElasticSearch - index server used as a document database
Robert Lujo
 
PDF
Elasticsearch in 15 minutes
David Pilato
 
PPTX
The ultimate guide for Elasticsearch plugins
Itamar
 
PPTX
ElasticSearch - DevNexus Atlanta - 2014
Roy Russo
 
PPSX
What I learnt: Elastic search & Kibana : introduction, installtion & configur...
Rahul K Chauhan
 
PPTX
Intro to elasticsearch
Joey Wen
 
PDF
Workshop: Learning Elasticsearch
Anurag Patel
 
PDF
Intro to Elasticsearch
Clifford James
 
ODP
Elastic search
NexThoughts Technologies
 
PDF
Introduction to Elasticsearch
Sperasoft
 
PPTX
Elastic search Walkthrough
Suhel Meman
 
PPTX
Elastic search overview
ABC Talks
 
ODP
Cool bonsai cool - an introduction to ElasticSearch
clintongormley
 
PPTX
Elasticsearch
Ricardo Peres
 
PPTX
Elasticsearch - DevNexus 2015
Roy Russo
 
PDF
Simple search with elastic search
markstory
 
PDF
Roaring with elastic search sangam2018
Vinay Kumar
 
PPTX
quick intro to elastic search
medcl
 
PPTX
Introduction to Elasticsearch
Bo Andersen
 
KEY
Elasticsearch - Devoxx France 2012 - English version
David Pilato
 
ElasticSearch - index server used as a document database
Robert Lujo
 
Elasticsearch in 15 minutes
David Pilato
 
The ultimate guide for Elasticsearch plugins
Itamar
 
ElasticSearch - DevNexus Atlanta - 2014
Roy Russo
 
What I learnt: Elastic search & Kibana : introduction, installtion & configur...
Rahul K Chauhan
 
Intro to elasticsearch
Joey Wen
 
Workshop: Learning Elasticsearch
Anurag Patel
 
Intro to Elasticsearch
Clifford James
 
Elastic search
NexThoughts Technologies
 
Introduction to Elasticsearch
Sperasoft
 
Elastic search Walkthrough
Suhel Meman
 
Elastic search overview
ABC Talks
 
Cool bonsai cool - an introduction to ElasticSearch
clintongormley
 
Elasticsearch
Ricardo Peres
 
Elasticsearch - DevNexus 2015
Roy Russo
 
Simple search with elastic search
markstory
 
Roaring with elastic search sangam2018
Vinay Kumar
 
quick intro to elastic search
medcl
 
Introduction to Elasticsearch
Bo Andersen
 
Elasticsearch - Devoxx France 2012 - English version
David Pilato
 

Similar to Introduction to Elasticsearch (20)

PPTX
Elasticsearch an overview
Amit Juneja
 
PDF
Elasticsearch Quick Introduction
imotov
 
PPTX
Open Source Search: An Analysis
Justin Finkelstein
 
PDF
Elasticsearch at EyeEm
Lars Fronius
 
PDF
Elasticsearch in 15 Minutes
Karel Minarik
 
PDF
Hopper Elasticsearch Hackathon
imotov
 
PPT
How ElasticSearch lives in my DevOps life
琛琳 饶
 
PPTX
ElasticSearch AJUG 2013
Roy Russo
 
PDF
Into The Box 2018 cbelasticsearch
Ortus Solutions, Corp
 
PPT
Elastic search introduction
Jackson dos Santos Olveira
 
PDF
Elasticsearch
Andrii Gakhov
 
PDF
Fazendo mágica com ElasticSearch
Pedro Franceschi
 
PDF
elasticsearch - advanced features in practice
Jano Suchal
 
PPTX
Extended JOIN in Couchbase Server 4.5
Keshav Murthy
 
PDF
ELK - What's new and showcases
Andrii Gakhov
 
PDF
NoSQL Matters 2013 - Introduction to Map Reduce with Couchbase 2.0
Tugdual Grall
 
PDF
Análisis del roadmap del Elastic Stack
Elasticsearch
 
PDF
ITB2019 Easy ElasticSearch with cbElasticSearch - Jon Clausen
Ortus Solutions, Corp
 
PDF
Elastic Stack roadmap deep dive
Elasticsearch
 
PDF
Análisis de las novedades del Elastic Stack
Elasticsearch
 
Elasticsearch an overview
Amit Juneja
 
Elasticsearch Quick Introduction
imotov
 
Open Source Search: An Analysis
Justin Finkelstein
 
Elasticsearch at EyeEm
Lars Fronius
 
Elasticsearch in 15 Minutes
Karel Minarik
 
Hopper Elasticsearch Hackathon
imotov
 
How ElasticSearch lives in my DevOps life
琛琳 饶
 
ElasticSearch AJUG 2013
Roy Russo
 
Into The Box 2018 cbelasticsearch
Ortus Solutions, Corp
 
Elastic search introduction
Jackson dos Santos Olveira
 
Elasticsearch
Andrii Gakhov
 
Fazendo mágica com ElasticSearch
Pedro Franceschi
 
elasticsearch - advanced features in practice
Jano Suchal
 
Extended JOIN in Couchbase Server 4.5
Keshav Murthy
 
ELK - What's new and showcases
Andrii Gakhov
 
NoSQL Matters 2013 - Introduction to Map Reduce with Couchbase 2.0
Tugdual Grall
 
Análisis del roadmap del Elastic Stack
Elasticsearch
 
ITB2019 Easy ElasticSearch with cbElasticSearch - Jon Clausen
Ortus Solutions, Corp
 
Elastic Stack roadmap deep dive
Elasticsearch
 
Análisis de las novedades del Elastic Stack
Elasticsearch
 
Ad

More from Jason Austin (12)

PDF
Service Oriented Architecture
Jason Austin
 
PDF
Design patterns
Jason Austin
 
PPT
How Beer Made Me A Better Developer
Jason Austin
 
PDF
Securing Your API
Jason Austin
 
ZIP
Preparing Traditional Media for a Mobile World
Jason Austin
 
ZIP
Object Oriented PHP5
Jason Austin
 
PDF
UNC CAUSE - Going Mobile On Campus
Jason Austin
 
PDF
RSS Like A Ninja
Jason Austin
 
PDF
Lean mean php machine
Jason Austin
 
PDF
Web Hosting Pilot - NC State University
Jason Austin
 
PDF
Tweeting For NC State University
Jason Austin
 
PDF
Pathways Project on NCSU Web Dev
Jason Austin
 
Service Oriented Architecture
Jason Austin
 
Design patterns
Jason Austin
 
How Beer Made Me A Better Developer
Jason Austin
 
Securing Your API
Jason Austin
 
Preparing Traditional Media for a Mobile World
Jason Austin
 
Object Oriented PHP5
Jason Austin
 
UNC CAUSE - Going Mobile On Campus
Jason Austin
 
RSS Like A Ninja
Jason Austin
 
Lean mean php machine
Jason Austin
 
Web Hosting Pilot - NC State University
Jason Austin
 
Tweeting For NC State University
Jason Austin
 
Pathways Project on NCSU Web Dev
Jason Austin
 
Ad

Recently uploaded (20)

DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Designing Production-Ready AI Agents
Kunal Rai
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 

Introduction to Elasticsearch

  • 2. The Problem • You are building a website to find beers • You have a huge database of beers and breweries to sift through • You want simple keyword-based searching • You also want structured searching, like finding all beers > 7% ABV • You want to run some analytics on what beers are in your dataset
  • 3. Enter Elasticsearch • Lucene based • Distributed • Fast • RESTful interface • Document-Based with JSON
  • 5. Install Elasticsearch • Download from http://elasticsearch.org • Requires Java to run
  • 6. Run Elasticsearch • From the install directory: ./bin/elasticsearch -d! ! http://localhost:9200/!
  • 7. Communicating • Elasticsearch listens to RESTful HTTP requests • GET, POST, PUT, DELETE • CURL works just fine
  • 10. Create an Index curl -XPOST 'http://localhost:9200/phpbeer'
  • 11. What to Search? • Define the types of things to search • Beer • Brewery - Maybe later
  • 12. Define a Beer • Name • Style • ABV • Brewery ‣ Name ‣ City
  • 13. Beer JSON {
 ! "name": "Pliny the Elder",
 ! "style": "Imperial India Pale Ale",
 ! "abv": 7.0,
 ! "brewery": {
 ! ! "name": "Russian River Brewing Co.",
 ! ! "city": "Santa Rosa",
 "state": "California"
 ! }
 }

  • 14. SavingThe Beer curl -XPOST 'http://localhost:9200/ phpbeer/beer/1' -d '{
 ! "name": "Pliny the Elder",
 ! "style": "Imperial India Pale Ale",
 ! "abv": 7.0,
 ! "brewery": {
 ! ! "name": "Russian River Brewing Co.",
 ! ! "city": "Santa Rosa",
 "state": "California"
 ! }
 }'

  • 15. Getting a beer curl -XGET 'http://localhost:9200/phpbeer/ beer/1?pretty'
  • 16. Updating a Beer curl -XPOST 'http://localhost:9200/ phpbeer/beer/1' -d '{
 ! "name": "Pliny the Elder",
 ! "style": "Imperial India Pale Ale",
 ! "abv": 8.0,
 ! "brewery": {
 ! ! "name": "Russian River Brewing Co.",
 ! ! "city": "Santa Rosa",
 "state": "California"
 ! }
 }'

  • 17. POSTvs PUT • POST • No ID - Creates new doc, assigns ID • With ID - Updates or creates new doc • PUT • No ID - Error • With ID - Updates doc
  • 18. Delete a Beer curl -XDELETE 'http://localhost:9200/ phpbeer/beer/1'
  • 19. Finally! Searching! curl -XGET 'http://localhost:9200/_search? pretty&q=pliny'
  • 20. Specific Field Searching curl -XGET 'http://localhost:9200/_search? pretty&q=style:pliny'! curl -XGET 'http://localhost:9200/_search? pretty&q=style:imperial'
  • 21. Alternate Approach • Search using DSL (Domain Specific Language) • JSON in request body
  • 22. DSL Searching curl -XGET 'http://localhost:9200/_search? pretty' -d '{
 "query" : {
 "match" : {
 "style" : "imperial"
 }
 }
 }'
  • 23. DSL = Query + Filter • Query - “How well does the document match” • Filter - Yes or No question on the field
  • 24. Query DSL • match • Used to query across all fields for a string • match_phrase • Used to query an exact phrase • match_all • Matches all documents • multi_match • Runs the same match query on multiple fields
  • 25. Filter DSL • term • Exact match on a field • range • Match numbers over a specified range • exists / missing • Match based on the existence of a value for a field
  • 26. More Complex Search • Find beer whose styles include “Pale Ale” that are less than 7% ABV
  • 27. Match + Range curl -XGET 'http://localhost:9200/_search?pretty' -d '{
 "query" : {
 "match" : {
 "style" : "pale ale"
 }
 },
 "filter" : {
 "range" : {
 "abv" : { "lt" : 7 }
 }
 }
 }'
  • 28. Embedded Field Search curl -XGET 'http://localhost:9200/_search?pretty' -d '{
 "query" : {
 "match" : {
 "brewery.state" : "California"
 }
 }
 }'
  • 30. Highlighting Search Results curl -XGET 'http://localhost:9200/_search?pretty' -d '{
 "query" : {
 "match" : {
 "style" : "pale ale"
 }
 },
 "highlight": {
 "fields" : {
 "style" : {}
 }
 }
 }'
  • 31. Aggregations • Collect analytics on your documents • 2 main types • Bucketing • Produce a set of buckets with documents in them • Metric • Compute metrics over a set of documents
  • 33. Metric Aggregations • How many beers exist of each style? • What is the average ABV of beers for each style? • How many beers exist that are brewed in California?
  • 34. What is the average ABV of beers for each style? curl -XGET 'http://localhost:9200/_search?pretty' -d '{
 "aggs" : {
 "all_beers" : {
 "terms" : { "field" : "style" },
 "aggs" : {
 "avg_abv" : {
 "avg" : { "field" : "abv" }
 }
 }
 }
 }
 }'
  • 35. Mappings • Define how ES searches • Completely optional • Must re-index after defining mapping
  • 36. Create Index with Mapping curl -XPOST localhost:9200/phpbeer -d '{
 "mappings" : {
 "beer" : {
 "_source" : { "enabled" : true },
 "properties" : {
 "style" : { 
 "type" : "string", 
 "index" : "not_analyzed" 
 }
 }
 }
 }
 }' curl -XDELETE localhost:9200/phpbeer
  • 37. What is the average ABV of beers for each style? curl -XGET 'http://localhost:9200/_search?pretty' -d '{
 "aggs" : {
 "all_beers" : {
 "terms" : { "field" : "style" },
 "aggs" : {
 "avg_abv" : {
 "avg" : { "field" : "abv" }
 }
 }
 }
 }
 }'
  • 38. Non-Analyzed Fields curl -XGET 'http://localhost:9200/_search? pretty&q=style:imperial'! curl -XGET 'http://localhost:9200/_search? pretty&q=style:hefeweizen'
  • 39. Flexibility • Mixing aggregations, filters and queries all together • What beers have the word “night” in the name that are between 4 and 6 % ABV, broken down by style.
  • 40. Elasticsearch and PHP • Elasticsearch PHP Lib
 https://github.com/elasticsearch/elasticsearch-php • Elastica
 http://elastica.io/
  • 41. Other Awesome ES Features • Search analyzers • Geo-based searching • Elasticsearch Plugins • kopf - http://localhost:9200/_plugin/kopf
  • 42. Questions? • @jason_austin • http://www.pintlabs.com • https://joind.in/10821