SlideShare a Scribd company logo
Elasticsearch
Tony Messias
MaceioDevMeetup #5
who am I?
➔ Tony Messias ~ @tony0x01
➔ Building web stuff since ~2010
search
what is “search”?
“A search is the organized pursuit of
information (...) that you want to find, but
you have no idea where it is.”
(NASA).
how do we add search to our apps?
➔ SQL queries (not just LIKE queries);
➔ Elasticsearch;
➔ Lucene;
➔ Solr;
➔ …
how do we add search to our apps?
➔ SQL queries (not just LIKE queries);
➔ Elasticsearch;
➔ Lucene;
➔ Solr;
➔ …
who uses it?
what is Elasticsearch?
➔ database server;
➔ document based;
➔ based on Apache Lucene;
➔ schema-free*;
why Elasticsearch?
➔ speaks HTTP/JSON;
➔ easy to setup;
➔ data replication;
➔ easily scalable;
what can I use it for?
but it can do more
than that…
some analogy *
Relational ES
database index
table type
row document
column field
schema mapping
index everything
SQL QueryDSL
REST(ish)
$ curl -XPOST http://es-server.com/index/type/id
-d '{}'
REST(ish)
$ curl -XPOST http://es-server.com/index/type/id
-d '{}'
REST(ish)
$ curl -XPOST http://es-server.com/index/type/id
-d '{}'
REST(ish)
$ curl -XPOST http://es-server.com/index/type/id
-d '{}'
REST(ish)
$ curl -XPOST http://es-server.com/index/type/id
-d '{}'
enough with the
talking… let’s do
some searches!
but first, let’s talk
about CRUD
indexing
{
"email": "john@smith.com",
"first_name": "John",
"last_name": "Smith",
"info": {
"bio": "Eco-warrior and defender of the weak",
"age": 25,
"interests": [ "dolphins", "whales" ]
},
"join_date": "2014/05/01"
}
$ curl -XPOST localhost:9200/my-app/users -d ‘{
"email": "john@smith.com",
"first_name": "John",
"last_name": "Smith",
"info": {
"bio": "Eco-warrior and defender of the weak",
"age": 25,
"interests": [ "dolphins", "whales" ]
},
"join_date": "2014/05/01"
}’
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOBeJbue-jeR3jNcHj",
"_version": 1,
"created": true
}
$ curl -XPUT localhost:9200/my-app/users/AUxOBeJbue-jeR3jNcHj -d
‘{
"email": "john@smith.com",
"first_name": "John"
}’
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOBeJbue-jeR3jNcHj",
"_version": 2,
"created": false
}
$ curl -XGET localhost:9200/my-app/users/AUxOBeJbue-jeR3jNcHj
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOJe-4ue-jeR3jNcHo",
"_version": 2,
"found": true,
"_source": {
"email": "john@smith.com",
"first_name": "John"
}
}
$ curl -XDELETE localhost:9200/my-app/users/AUxOBeJbue-jeR3jNcHj
{
"found": true,
"_index": "my-app",
"_type": "users",
"_id": "AUxOBeJbue-jeR3jNcHj",
"_version": 3
}
searching
$ curl -XPOST localhost:9200/my-app/users/_search -d ‘{
"query": {
"match": {
"first_name": "John"
}
}
}’
{
...,
"hits": {
"total": 4,
"max_score": 0.30685282,
"hits": [
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOJWlCue-jeR3jNcHn",
"_score": 0.30685282,
"_source": {
"email": "john@smith.com",
"first_name": "John",
"last_name": "Doe",
"info": {
"bio": "Like rock music",
"age": 35,
"interests": [
"dolphins",
"whales"
]
},
"join_date": "2014/05/01"
}
},...
$ curl -XPOST localhost:9200/my-app/users/_search -d ‘{
"query": {
"filtered": {
"query": {
"match": {
"first_name": "John"
}
},
"filter": {
"range": {
"info.age": {
"gt": 34
}
}
}
}
}
}’
{
"took": 6,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.30685282,
"hits": [
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOJWlCue-jeR3jNcHn",
"_score": 0.30685282,
"_source": {
"email": "john@smith.com",
"first_name": "John",
"last_name": "Doe",
"info": {
"bio": "Like rock music",
"age": 35,
"interests": ["dolphins","whales"]
},
"join_date": "2014/05/01"
}
}
]
}
}
queries vs. filters
queries vs. filters
full-text search
$ curl -XPOST localhost:9200/my-app/users/_search -d ‘{
"query": {
"match": {
"info.bio": "rock climbing"
}
}
}’
{
"took": 9,
"timed_out": false,
"_shards": {...},
"hits": {
"total": 2,
"max_score": 0.2169777,
"hits": [
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOJe-4ue-jeR3jNcHo",
"_score": 0.2169777,
"_source": {
"email": "john@smith.com",
"first_name": "John",
"last_name": "Kennedy",
"info": {
"bio": "I love rock climbing!",
"age": 29,
"interests": ["dolphins","whales"]
},
"join_date": "2014/05/01"
}
},
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOJWlCue-jeR3jNcHn",
"_score": 0.02250402,
"_source": {
"email": "john@smith.com",
"first_name": "John",
"last_name": "Doe",
"info": {
"bio": "Like rock music",
"age": 35,
"interests": ["dolphins","whales"]
},
"join_date": "2014/05/01"
}
}
]
}
}
$ curl -XPOST localhost:9200/my-app/users/_search -d ‘{
"query": {
"match_phrase": {
"info.bio": "rock climbing"
}
}
}’
{…,
"hits": {
"total": 1,
"max_score": 0.30685282,
"hits": [
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOJe-4ue-jeR3jNcHo",
"_score": 0.30685282,
"_source": {
"email": "john@smith.com",
"first_name": "John",
"last_name": "Kennedy",
"info": {
"bio": "I love rock climbing!",
"age": 29,
"interests": ["dolphins","whales"]
},
"join_date": "2014/05/01"
}
}
]
}
}
$ curl -XPOST localhost:9200/my-app/users/_search -d ‘{
"query": {
"match_phrase": {
"info.bio": "rock climbing"
}
},
"highlight": {
"fields": {
"info.bio": {}
}
}
}’
...
{
"_index": "my-app",
"_type": "users",
"_id": "AUxOJe-4ue-jeR3jNcHo",
"_score": 0.30685282,
"_source": {
"email": "john@smith.com",
"first_name": "John",
"last_name": "Kennedy",
"info": {
"bio": "I love rock climbing!",
"age": 29,
"interests": ["dolphins","whales"]
},
"join_date": "2014/05/01"
},
"highlight": {
"info.bio": ["I love <em>rock</em> <em>climbing</em>!"]
}
}
]
}
}
is this it?
analytics
aggregations
buckets metrics
$ curl -XPOST localhost:9200/my-app/users/_search?search_type=count -d'{
"aggs": {
"all_interests": {
"terms": {
"field": "info.interests"
}
}
}
}'
{ ...,
"hits": {"total": 4,"max_score": 0,"hits": []},
"aggregations": {
"all_interests": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "whales",
"doc_count": 4
},
{
"key": "dolphins",
"doc_count": 3
}
]
}
}}
$ curl -XPOST localhost:9200/my-app/users/_search?search_type=count -d'{
"aggs": {
"all_interests": {
"terms": {
"field": "info.interests"
}
}
}
}'
$ curl -XPOST localhost:9200/my-app/users/_search?search_type=count -d'{
"aggs": {
"all_interests": {
"terms": {
"field": "info.interests"
},
"aggs": {
"avg_age": {
"avg": {
"field": "info.age"
}
}
}
}
}
}'
{
…,
"aggregations": {
"all_interests": {
…,
"buckets": [
{
"key": "whales",
"doc_count": 4,
"avg_age": { "value": 31.5 }
},
{
"key": "dolphins",
"doc_count": 3,
"avg_age": { "value": 32.333333333333336 }
}
]
}}}
$ curl -XPOST localhost:9200/my-app/users/_search?search_type=count -d'{
"query": {
"match_phrase": {
"info.bio": "rock climbing"
}
},
"aggs": {
"all_interests": {
"terms": { "field": "info.interests" },
"aggs": {
"avg_age": {
"avg": { "field": "info.age" }
}
}
}
}}'
{
…,
"aggregations": {
"all_interests": {
…,
"buckets": [
{
"key": "whales",
"doc_count": 1,
"avg_age": {
"value": 29
}
}
]
}}}
questions?
Resources
➔ http://www.elastic.
co/guide/en/elasticsearch/guide/current/index.
html
➔ https://leanpub.com/elasticsearch-quick-start
➔ https://www.elastic.co/use-cases
➔ https://speakerdeck.com/asm89/elasticsearch
Resources
➔ https://speakerdeck.
com/johnbeynon/elasticsearch-101
➔ http://blog.madewithlove.be/post/integrating-
elasticsearch-with-your-laravel-app/
➔ http://blog.madewithlove.be/post/elasticsearch-
aggregations/

More Related Content

What's hot

Data Representation - Day 2
Data Representation - Day 2Data Representation - Day 2
Data Representation - Day 2
blprnt
 
Processing & Dataviz
Processing & DatavizProcessing & Dataviz
Processing & Dataviz
blprnt
 
Building Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and HydraBuilding Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and Hydra
Markus Lanthaler
 
Terms of endearment - the ElasticSearch Query DSL explained
Terms of endearment - the ElasticSearch Query DSL explainedTerms of endearment - the ElasticSearch Query DSL explained
Terms of endearment - the ElasticSearch Query DSL explained
clintongormley
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked Data
Gregg Kellogg
 
JSON-LD: Linked Data for Web Apps
JSON-LD: Linked Data for Web AppsJSON-LD: Linked Data for Web Apps
JSON-LD: Linked Data for Web AppsGregg Kellogg
 
2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQLHung-yu Lin
 
JSON-LD and MongoDB
JSON-LD and MongoDBJSON-LD and MongoDB
JSON-LD and MongoDB
Gregg Kellogg
 
Wsomdp
WsomdpWsomdp
Wsomdp
riahialae
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB
 
JWT - To authentication and beyond!
JWT - To authentication and beyond!JWT - To authentication and beyond!
JWT - To authentication and beyond!
Luís Cobucci
 
SF ElasticSearch Meetup - How HipChat Scaled to 1B Messages
SF ElasticSearch Meetup - How HipChat Scaled to 1B MessagesSF ElasticSearch Meetup - How HipChat Scaled to 1B Messages
SF ElasticSearch Meetup - How HipChat Scaled to 1B Messages
Atlassian
 
Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, FlaxCoffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
Lucidworks
 
Hydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIsHydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIs
Markus Lanthaler
 
How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)
How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)
How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)
Paul Richards
 
Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs - Front in Bahia...
Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs  - Front in Bahia...Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs  - Front in Bahia...
Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs - Front in Bahia...
Ícaro Medeiros
 
Building Web Services for Mobile Apps
Building Web Services for Mobile AppsBuilding Web Services for Mobile Apps
Building Web Services for Mobile Apps
Sepialabs
 
3. javascript bangla tutorials
3. javascript bangla tutorials3. javascript bangla tutorials
3. javascript bangla tutorials
SEOPROFFESSIONALDIGI
 
MongoDB and Indexes - MUG Denver - 20160329
MongoDB and Indexes - MUG Denver - 20160329MongoDB and Indexes - MUG Denver - 20160329
MongoDB and Indexes - MUG Denver - 20160329
Douglas Duncan
 

What's hot (20)

Data Representation - Day 2
Data Representation - Day 2Data Representation - Day 2
Data Representation - Day 2
 
Processing & Dataviz
Processing & DatavizProcessing & Dataviz
Processing & Dataviz
 
Building Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and HydraBuilding Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and Hydra
 
Terms of endearment - the ElasticSearch Query DSL explained
Terms of endearment - the ElasticSearch Query DSL explainedTerms of endearment - the ElasticSearch Query DSL explained
Terms of endearment - the ElasticSearch Query DSL explained
 
Data exchange formats
Data exchange formatsData exchange formats
Data exchange formats
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked Data
 
JSON-LD: Linked Data for Web Apps
JSON-LD: Linked Data for Web AppsJSON-LD: Linked Data for Web Apps
JSON-LD: Linked Data for Web Apps
 
2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL
 
JSON-LD and MongoDB
JSON-LD and MongoDBJSON-LD and MongoDB
JSON-LD and MongoDB
 
Wsomdp
WsomdpWsomdp
Wsomdp
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB Performance
 
JWT - To authentication and beyond!
JWT - To authentication and beyond!JWT - To authentication and beyond!
JWT - To authentication and beyond!
 
SF ElasticSearch Meetup - How HipChat Scaled to 1B Messages
SF ElasticSearch Meetup - How HipChat Scaled to 1B MessagesSF ElasticSearch Meetup - How HipChat Scaled to 1B Messages
SF ElasticSearch Meetup - How HipChat Scaled to 1B Messages
 
Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, FlaxCoffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
 
Hydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIsHydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIs
 
How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)
How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)
How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)
 
Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs - Front in Bahia...
Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs  - Front in Bahia...Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs  - Front in Bahia...
Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs - Front in Bahia...
 
Building Web Services for Mobile Apps
Building Web Services for Mobile AppsBuilding Web Services for Mobile Apps
Building Web Services for Mobile Apps
 
3. javascript bangla tutorials
3. javascript bangla tutorials3. javascript bangla tutorials
3. javascript bangla tutorials
 
MongoDB and Indexes - MUG Denver - 20160329
MongoDB and Indexes - MUG Denver - 20160329MongoDB and Indexes - MUG Denver - 20160329
MongoDB and Indexes - MUG Denver - 20160329
 

Viewers also liked

Contrato de arrendamiento
Contrato de arrendamientoContrato de arrendamiento
Contrato de arrendamiento
Rosmeri Romero
 
Global Hotel Alliance: Campaign Automation on a Global Scale
Global Hotel Alliance: Campaign Automation on a Global ScaleGlobal Hotel Alliance: Campaign Automation on a Global Scale
Global Hotel Alliance: Campaign Automation on a Global Scale
BlueHornet
 
Plan de Competitividad de Turismo Activo. Sierra de Gredos y Valle de Iruelas...
Plan de Competitividad de Turismo Activo. Sierra de Gredos y Valle de Iruelas...Plan de Competitividad de Turismo Activo. Sierra de Gredos y Valle de Iruelas...
Plan de Competitividad de Turismo Activo. Sierra de Gredos y Valle de Iruelas...
Turismo de Ávila
 
Alfresco DevCon 2011. Implementing eGov Portal. Powered by Alfresco and Orbeon
Alfresco DevCon 2011. Implementing eGov Portal. Powered by Alfresco and OrbeonAlfresco DevCon 2011. Implementing eGov Portal. Powered by Alfresco and Orbeon
Alfresco DevCon 2011. Implementing eGov Portal. Powered by Alfresco and OrbeonOksana Kurysheva
 
Desarrollo de software seguro: una visión con OpenSAMM
Desarrollo de software seguro: una visión con OpenSAMMDesarrollo de software seguro: una visión con OpenSAMM
Desarrollo de software seguro: una visión con OpenSAMM
Internet Security Auditors
 
Group office
Group officeGroup office
Group office
Marco Mocellini
 
Fac pubmed
Fac   pubmedFac   pubmed
Company profile twa
Company profile twaCompany profile twa
Company profile twa
Ratman Bejo
 
El algodón engaña. Nuestro algodón Fox Fibre Cologranic, no.
El algodón engaña. Nuestro algodón Fox Fibre Cologranic, no.El algodón engaña. Nuestro algodón Fox Fibre Cologranic, no.
El algodón engaña. Nuestro algodón Fox Fibre Cologranic, no.
FoxFibre Colorganic
 
Luxury surface
Luxury surfaceLuxury surface
Luxury surface
iliay Tchertkov
 
Codemotion Mad 2014 - Things I love seeing when I buy something online - Brai...
Codemotion Mad 2014 - Things I love seeing when I buy something online - Brai...Codemotion Mad 2014 - Things I love seeing when I buy something online - Brai...
Codemotion Mad 2014 - Things I love seeing when I buy something online - Brai...
Alberto López Martín
 
Cyber Security, Why It's important To You
Cyber Security, Why It's important To YouCyber Security, Why It's important To You
Cyber Security, Why It's important To YouRonald E. Laub Jr
 
Newsletter N°14 Mes de Junio
Newsletter N°14 Mes de JunioNewsletter N°14 Mes de Junio
Newsletter N°14 Mes de JunioWest Lubricantes
 
HoneySpider Network: a Java based system to hunt down malicious websites
HoneySpider Network: a Java based system to hunt down malicious websitesHoneySpider Network: a Java based system to hunt down malicious websites
HoneySpider Network: a Java based system to hunt down malicious websitesNLJUG
 
3. STAY IN Newsletter
3. STAY IN Newsletter3. STAY IN Newsletter
3. STAY IN Newsletter
Michaela Meier
 
M3 Sistema de rastreo vehicular
M3 Sistema de rastreo vehicularM3 Sistema de rastreo vehicular
M3 Sistema de rastreo vehicular
Juan Carlos Abaunza Ardila
 
Revista educaccion
Revista educaccionRevista educaccion
Revista educaccion
fabianandressuarez
 
01 orthokeratology children chan
01  orthokeratology children chan01  orthokeratology children chan
01 orthokeratology children chanortokextremadura
 
LatinMarket
LatinMarketLatinMarket
LatinMarket
Luis Cam
 

Viewers also liked (20)

Contrato de arrendamiento
Contrato de arrendamientoContrato de arrendamiento
Contrato de arrendamiento
 
Global Hotel Alliance: Campaign Automation on a Global Scale
Global Hotel Alliance: Campaign Automation on a Global ScaleGlobal Hotel Alliance: Campaign Automation on a Global Scale
Global Hotel Alliance: Campaign Automation on a Global Scale
 
Plan de Competitividad de Turismo Activo. Sierra de Gredos y Valle de Iruelas...
Plan de Competitividad de Turismo Activo. Sierra de Gredos y Valle de Iruelas...Plan de Competitividad de Turismo Activo. Sierra de Gredos y Valle de Iruelas...
Plan de Competitividad de Turismo Activo. Sierra de Gredos y Valle de Iruelas...
 
Alfresco DevCon 2011. Implementing eGov Portal. Powered by Alfresco and Orbeon
Alfresco DevCon 2011. Implementing eGov Portal. Powered by Alfresco and OrbeonAlfresco DevCon 2011. Implementing eGov Portal. Powered by Alfresco and Orbeon
Alfresco DevCon 2011. Implementing eGov Portal. Powered by Alfresco and Orbeon
 
Desarrollo de software seguro: una visión con OpenSAMM
Desarrollo de software seguro: una visión con OpenSAMMDesarrollo de software seguro: una visión con OpenSAMM
Desarrollo de software seguro: una visión con OpenSAMM
 
Group office
Group officeGroup office
Group office
 
Fac pubmed
Fac   pubmedFac   pubmed
Fac pubmed
 
Company profile twa
Company profile twaCompany profile twa
Company profile twa
 
El algodón engaña. Nuestro algodón Fox Fibre Cologranic, no.
El algodón engaña. Nuestro algodón Fox Fibre Cologranic, no.El algodón engaña. Nuestro algodón Fox Fibre Cologranic, no.
El algodón engaña. Nuestro algodón Fox Fibre Cologranic, no.
 
Luxury surface
Luxury surfaceLuxury surface
Luxury surface
 
Codemotion Mad 2014 - Things I love seeing when I buy something online - Brai...
Codemotion Mad 2014 - Things I love seeing when I buy something online - Brai...Codemotion Mad 2014 - Things I love seeing when I buy something online - Brai...
Codemotion Mad 2014 - Things I love seeing when I buy something online - Brai...
 
Cyber Security, Why It's important To You
Cyber Security, Why It's important To YouCyber Security, Why It's important To You
Cyber Security, Why It's important To You
 
Newsletter N°14 Mes de Junio
Newsletter N°14 Mes de JunioNewsletter N°14 Mes de Junio
Newsletter N°14 Mes de Junio
 
HoneySpider Network: a Java based system to hunt down malicious websites
HoneySpider Network: a Java based system to hunt down malicious websitesHoneySpider Network: a Java based system to hunt down malicious websites
HoneySpider Network: a Java based system to hunt down malicious websites
 
Version cd web definitiva
Version cd web definitivaVersion cd web definitiva
Version cd web definitiva
 
3. STAY IN Newsletter
3. STAY IN Newsletter3. STAY IN Newsletter
3. STAY IN Newsletter
 
M3 Sistema de rastreo vehicular
M3 Sistema de rastreo vehicularM3 Sistema de rastreo vehicular
M3 Sistema de rastreo vehicular
 
Revista educaccion
Revista educaccionRevista educaccion
Revista educaccion
 
01 orthokeratology children chan
01  orthokeratology children chan01  orthokeratology children chan
01 orthokeratology children chan
 
LatinMarket
LatinMarketLatinMarket
LatinMarket
 

Similar to Introduction to Elasticsearch

ElasticSearch in action
ElasticSearch in actionElasticSearch in action
ElasticSearch in action
Codemotion
 
Montreal Elasticsearch Meetup
Montreal Elasticsearch MeetupMontreal Elasticsearch Meetup
Montreal Elasticsearch Meetup
Loïc Bertron
 
Introduction to Elasticsearch for Business Intelligence and Application Insights
Introduction to Elasticsearch for Business Intelligence and Application InsightsIntroduction to Elasticsearch for Business Intelligence and Application Insights
Introduction to Elasticsearch for Business Intelligence and Application Insights
Data Works MD
 
Elasticsearch - Zero to Hero
Elasticsearch - Zero to HeroElasticsearch - Zero to Hero
Elasticsearch - Zero to Hero
Daniel Ziv
 
Elasticmeetup curiosity 20141113
Elasticmeetup curiosity 20141113Elasticmeetup curiosity 20141113
Elasticmeetup curiosity 20141113Erwan Pigneul
 
Curiosity, outil de recherche open source par PagesJaunes
Curiosity, outil de recherche open source par PagesJaunesCuriosity, outil de recherche open source par PagesJaunes
Curiosity, outil de recherche open source par PagesJaunes
PagesJaunes
 
Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by Case
Alexandre Rafalovitch
 
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Codemotion
 
In search of: A meetup about Liferay and Search 2016-04-20
In search of: A meetup about Liferay and Search   2016-04-20In search of: A meetup about Liferay and Search   2016-04-20
In search of: A meetup about Liferay and Search 2016-04-20
Tibor Lipusz
 
Test Trend Analysis : Towards robust, reliable and timely tests
Test Trend Analysis : Towards robust, reliable and timely testsTest Trend Analysis : Towards robust, reliable and timely tests
Test Trend Analysis : Towards robust, reliable and timely tests
Hugh McCamphill
 
Beautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with IonBeautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with Ion
Stormpath
 
DRUPAL AND ELASTICSEARCH
DRUPAL AND ELASTICSEARCHDRUPAL AND ELASTICSEARCH
DRUPAL AND ELASTICSEARCH
DrupalCamp Kyiv
 
How ElasticSearch lives in my DevOps life
How ElasticSearch lives in my DevOps lifeHow ElasticSearch lives in my DevOps life
How ElasticSearch lives in my DevOps life琛琳 饶
 
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
 
Scaling Analytics with elasticsearch
Scaling Analytics with elasticsearchScaling Analytics with elasticsearch
Scaling Analytics with elasticsearchdnoble00
 
Data Exploration with Elasticsearch
Data Exploration with ElasticsearchData Exploration with Elasticsearch
Data Exploration with Elasticsearch
Aleksander Stensby
 
You're not using ElasticSearch (outdated)
You're not using ElasticSearch (outdated)You're not using ElasticSearch (outdated)
You're not using ElasticSearch (outdated)
Timon Vonk
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenten
inovex GmbH
 
Real-time search in Drupal. Meet Elasticsearch
Real-time search in Drupal. Meet ElasticsearchReal-time search in Drupal. Meet Elasticsearch
Real-time search in Drupal. Meet ElasticsearchAlexei Gorobets
 
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
South Tyrol Free Software Conference
 

Similar to Introduction to Elasticsearch (20)

ElasticSearch in action
ElasticSearch in actionElasticSearch in action
ElasticSearch in action
 
Montreal Elasticsearch Meetup
Montreal Elasticsearch MeetupMontreal Elasticsearch Meetup
Montreal Elasticsearch Meetup
 
Introduction to Elasticsearch for Business Intelligence and Application Insights
Introduction to Elasticsearch for Business Intelligence and Application InsightsIntroduction to Elasticsearch for Business Intelligence and Application Insights
Introduction to Elasticsearch for Business Intelligence and Application Insights
 
Elasticsearch - Zero to Hero
Elasticsearch - Zero to HeroElasticsearch - Zero to Hero
Elasticsearch - Zero to Hero
 
Elasticmeetup curiosity 20141113
Elasticmeetup curiosity 20141113Elasticmeetup curiosity 20141113
Elasticmeetup curiosity 20141113
 
Curiosity, outil de recherche open source par PagesJaunes
Curiosity, outil de recherche open source par PagesJaunesCuriosity, outil de recherche open source par PagesJaunes
Curiosity, outil de recherche open source par PagesJaunes
 
Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by Case
 
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
 
In search of: A meetup about Liferay and Search 2016-04-20
In search of: A meetup about Liferay and Search   2016-04-20In search of: A meetup about Liferay and Search   2016-04-20
In search of: A meetup about Liferay and Search 2016-04-20
 
Test Trend Analysis : Towards robust, reliable and timely tests
Test Trend Analysis : Towards robust, reliable and timely testsTest Trend Analysis : Towards robust, reliable and timely tests
Test Trend Analysis : Towards robust, reliable and timely tests
 
Beautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with IonBeautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with Ion
 
DRUPAL AND ELASTICSEARCH
DRUPAL AND ELASTICSEARCHDRUPAL AND ELASTICSEARCH
DRUPAL AND ELASTICSEARCH
 
How ElasticSearch lives in my DevOps life
How ElasticSearch lives in my DevOps lifeHow ElasticSearch lives in my DevOps life
How ElasticSearch lives in my DevOps life
 
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!
 
Scaling Analytics with elasticsearch
Scaling Analytics with elasticsearchScaling Analytics with elasticsearch
Scaling Analytics with elasticsearch
 
Data Exploration with Elasticsearch
Data Exploration with ElasticsearchData Exploration with Elasticsearch
Data Exploration with Elasticsearch
 
You're not using ElasticSearch (outdated)
You're not using ElasticSearch (outdated)You're not using ElasticSearch (outdated)
You're not using ElasticSearch (outdated)
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenten
 
Real-time search in Drupal. Meet Elasticsearch
Real-time search in Drupal. Meet ElasticsearchReal-time search in Drupal. Meet Elasticsearch
Real-time search in Drupal. Meet Elasticsearch
 
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
 

More from Luiz Messias

Phoenix for laravel developers
Phoenix for laravel developersPhoenix for laravel developers
Phoenix for laravel developers
Luiz Messias
 
Turbolinks
TurbolinksTurbolinks
Turbolinks
Luiz Messias
 
Queues & Async Apps
 Queues & Async Apps Queues & Async Apps
Queues & Async Apps
Luiz Messias
 
Laravel's ecosystem
Laravel's ecosystemLaravel's ecosystem
Laravel's ecosystem
Luiz Messias
 
Command-Oriented Architecture
Command-Oriented ArchitectureCommand-Oriented Architecture
Command-Oriented Architecture
Luiz Messias
 
APIs seguras com OAuth2
APIs seguras com OAuth2APIs seguras com OAuth2
APIs seguras com OAuth2
Luiz Messias
 
Google App Engine e PHP
Google App Engine e PHPGoogle App Engine e PHP
Google App Engine e PHP
Luiz Messias
 

More from Luiz Messias (7)

Phoenix for laravel developers
Phoenix for laravel developersPhoenix for laravel developers
Phoenix for laravel developers
 
Turbolinks
TurbolinksTurbolinks
Turbolinks
 
Queues & Async Apps
 Queues & Async Apps Queues & Async Apps
Queues & Async Apps
 
Laravel's ecosystem
Laravel's ecosystemLaravel's ecosystem
Laravel's ecosystem
 
Command-Oriented Architecture
Command-Oriented ArchitectureCommand-Oriented Architecture
Command-Oriented Architecture
 
APIs seguras com OAuth2
APIs seguras com OAuth2APIs seguras com OAuth2
APIs seguras com OAuth2
 
Google App Engine e PHP
Google App Engine e PHPGoogle App Engine e PHP
Google App Engine e PHP
 

Recently uploaded

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 

Recently uploaded (20)

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 

Introduction to Elasticsearch

  • 2. who am I? ➔ Tony Messias ~ @tony0x01 ➔ Building web stuff since ~2010
  • 3.
  • 5. what is “search”? “A search is the organized pursuit of information (...) that you want to find, but you have no idea where it is.” (NASA).
  • 6. how do we add search to our apps? ➔ SQL queries (not just LIKE queries); ➔ Elasticsearch; ➔ Lucene; ➔ Solr; ➔ …
  • 7. how do we add search to our apps? ➔ SQL queries (not just LIKE queries); ➔ Elasticsearch; ➔ Lucene; ➔ Solr; ➔ …
  • 9.
  • 10. what is Elasticsearch? ➔ database server; ➔ document based; ➔ based on Apache Lucene; ➔ schema-free*;
  • 11. why Elasticsearch? ➔ speaks HTTP/JSON; ➔ easy to setup; ➔ data replication; ➔ easily scalable;
  • 12. what can I use it for?
  • 13.
  • 14. but it can do more than that…
  • 15. some analogy * Relational ES database index table type row document column field schema mapping index everything SQL QueryDSL
  • 16. REST(ish) $ curl -XPOST http://es-server.com/index/type/id -d '{}'
  • 17. REST(ish) $ curl -XPOST http://es-server.com/index/type/id -d '{}'
  • 18. REST(ish) $ curl -XPOST http://es-server.com/index/type/id -d '{}'
  • 19. REST(ish) $ curl -XPOST http://es-server.com/index/type/id -d '{}'
  • 20. REST(ish) $ curl -XPOST http://es-server.com/index/type/id -d '{}'
  • 21. enough with the talking… let’s do some searches!
  • 22. but first, let’s talk about CRUD
  • 23.
  • 25. { "email": "john@smith.com", "first_name": "John", "last_name": "Smith", "info": { "bio": "Eco-warrior and defender of the weak", "age": 25, "interests": [ "dolphins", "whales" ] }, "join_date": "2014/05/01" }
  • 26. $ curl -XPOST localhost:9200/my-app/users -d ‘{ "email": "john@smith.com", "first_name": "John", "last_name": "Smith", "info": { "bio": "Eco-warrior and defender of the weak", "age": 25, "interests": [ "dolphins", "whales" ] }, "join_date": "2014/05/01" }’
  • 27. { "_index": "my-app", "_type": "users", "_id": "AUxOBeJbue-jeR3jNcHj", "_version": 1, "created": true }
  • 28. $ curl -XPUT localhost:9200/my-app/users/AUxOBeJbue-jeR3jNcHj -d ‘{ "email": "john@smith.com", "first_name": "John" }’
  • 29. { "_index": "my-app", "_type": "users", "_id": "AUxOBeJbue-jeR3jNcHj", "_version": 2, "created": false }
  • 30. $ curl -XGET localhost:9200/my-app/users/AUxOBeJbue-jeR3jNcHj { "_index": "my-app", "_type": "users", "_id": "AUxOJe-4ue-jeR3jNcHo", "_version": 2, "found": true, "_source": { "email": "john@smith.com", "first_name": "John" } }
  • 31. $ curl -XDELETE localhost:9200/my-app/users/AUxOBeJbue-jeR3jNcHj { "found": true, "_index": "my-app", "_type": "users", "_id": "AUxOBeJbue-jeR3jNcHj", "_version": 3 }
  • 33. $ curl -XPOST localhost:9200/my-app/users/_search -d ‘{ "query": { "match": { "first_name": "John" } } }’
  • 34. { ..., "hits": { "total": 4, "max_score": 0.30685282, "hits": [ { "_index": "my-app", "_type": "users", "_id": "AUxOJWlCue-jeR3jNcHn", "_score": 0.30685282, "_source": { "email": "john@smith.com", "first_name": "John", "last_name": "Doe", "info": { "bio": "Like rock music", "age": 35, "interests": [ "dolphins", "whales" ] }, "join_date": "2014/05/01" } },...
  • 35. $ curl -XPOST localhost:9200/my-app/users/_search -d ‘{ "query": { "filtered": { "query": { "match": { "first_name": "John" } }, "filter": { "range": { "info.age": { "gt": 34 } } } } } }’
  • 36. { "took": 6, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 1, "max_score": 0.30685282, "hits": [ { "_index": "my-app", "_type": "users", "_id": "AUxOJWlCue-jeR3jNcHn", "_score": 0.30685282, "_source": { "email": "john@smith.com", "first_name": "John", "last_name": "Doe", "info": { "bio": "Like rock music", "age": 35, "interests": ["dolphins","whales"] }, "join_date": "2014/05/01" } } ] } }
  • 40. $ curl -XPOST localhost:9200/my-app/users/_search -d ‘{ "query": { "match": { "info.bio": "rock climbing" } } }’
  • 41. { "took": 9, "timed_out": false, "_shards": {...}, "hits": { "total": 2, "max_score": 0.2169777, "hits": [ { "_index": "my-app", "_type": "users", "_id": "AUxOJe-4ue-jeR3jNcHo", "_score": 0.2169777, "_source": { "email": "john@smith.com", "first_name": "John", "last_name": "Kennedy", "info": { "bio": "I love rock climbing!", "age": 29, "interests": ["dolphins","whales"] }, "join_date": "2014/05/01" } }, { "_index": "my-app", "_type": "users", "_id": "AUxOJWlCue-jeR3jNcHn", "_score": 0.02250402, "_source": { "email": "john@smith.com", "first_name": "John", "last_name": "Doe", "info": { "bio": "Like rock music", "age": 35, "interests": ["dolphins","whales"] }, "join_date": "2014/05/01" } } ] } }
  • 42. $ curl -XPOST localhost:9200/my-app/users/_search -d ‘{ "query": { "match_phrase": { "info.bio": "rock climbing" } } }’
  • 43. {…, "hits": { "total": 1, "max_score": 0.30685282, "hits": [ { "_index": "my-app", "_type": "users", "_id": "AUxOJe-4ue-jeR3jNcHo", "_score": 0.30685282, "_source": { "email": "john@smith.com", "first_name": "John", "last_name": "Kennedy", "info": { "bio": "I love rock climbing!", "age": 29, "interests": ["dolphins","whales"] }, "join_date": "2014/05/01" } } ] } }
  • 44. $ curl -XPOST localhost:9200/my-app/users/_search -d ‘{ "query": { "match_phrase": { "info.bio": "rock climbing" } }, "highlight": { "fields": { "info.bio": {} } } }’
  • 45. ... { "_index": "my-app", "_type": "users", "_id": "AUxOJe-4ue-jeR3jNcHo", "_score": 0.30685282, "_source": { "email": "john@smith.com", "first_name": "John", "last_name": "Kennedy", "info": { "bio": "I love rock climbing!", "age": 29, "interests": ["dolphins","whales"] }, "join_date": "2014/05/01" }, "highlight": { "info.bio": ["I love <em>rock</em> <em>climbing</em>!"] } } ] } }
  • 47.
  • 48.
  • 52. $ curl -XPOST localhost:9200/my-app/users/_search?search_type=count -d'{ "aggs": { "all_interests": { "terms": { "field": "info.interests" } } } }'
  • 53. { ..., "hits": {"total": 4,"max_score": 0,"hits": []}, "aggregations": { "all_interests": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [ { "key": "whales", "doc_count": 4 }, { "key": "dolphins", "doc_count": 3 } ] } }}
  • 54. $ curl -XPOST localhost:9200/my-app/users/_search?search_type=count -d'{ "aggs": { "all_interests": { "terms": { "field": "info.interests" } } } }'
  • 55. $ curl -XPOST localhost:9200/my-app/users/_search?search_type=count -d'{ "aggs": { "all_interests": { "terms": { "field": "info.interests" }, "aggs": { "avg_age": { "avg": { "field": "info.age" } } } } } }'
  • 56. { …, "aggregations": { "all_interests": { …, "buckets": [ { "key": "whales", "doc_count": 4, "avg_age": { "value": 31.5 } }, { "key": "dolphins", "doc_count": 3, "avg_age": { "value": 32.333333333333336 } } ] }}}
  • 57. $ curl -XPOST localhost:9200/my-app/users/_search?search_type=count -d'{ "query": { "match_phrase": { "info.bio": "rock climbing" } }, "aggs": { "all_interests": { "terms": { "field": "info.interests" }, "aggs": { "avg_age": { "avg": { "field": "info.age" } } } } }}'
  • 58. { …, "aggregations": { "all_interests": { …, "buckets": [ { "key": "whales", "doc_count": 1, "avg_age": { "value": 29 } } ] }}}
  • 59.