SlideShare a Scribd company logo
1 of 44
David Pilato
@dadoonet
elasticsearch
in 15 minutes
mercredi 3 juillet 13
Elasticsearch.com
• Créée en 2012 par les auteurs
d’Elasticsearch
• Formation (publique et intra)
• Consulting (support dév)
• Abonnement annuel support pour
la production avec 3 niveaux de
SLA
mercredi 3 juillet 13
Plug & Play
mercredi 3 juillet 13
Installation
$ wget https://download.elasticsearch.org/...
$ tar -xf elasticsearch-0.90.2.tar.gz
$ ./elasticsearch-0.90.2/bin/elasticsearch -f
... [INFO ][node][Ghost Maker] {0.90.2}[5645]: initializing ...
mercredi 3 juillet 13
Index a document...
$ curl -XPUT localhost:9200/products/product/1 -d '{
"title" : "Welcome!"
}'
mercredi 3 juillet 13
Update a document...
$ curl -XPUT localhost:9200/products/product/1 -d '{
"title" : "Welcome to the Elasticsearch meetup!"
}'
mercredi 3 juillet 13
{
"id" : "abc123",
"title" : "A JSON Document",
"body" : "A JSON document is a ...",
"published_on" : "2013/06/27 10:00:00",
"featured" : true,
"tags" : ["search", "json"],
"author" : {
"first_name" : "Clara",
"last_name" : "Rice",
"email" : "clara@rice.org"
}
}
Documents as JSON
Data structure with basic types, arrays and deep hierarchies
mercredi 3 juillet 13
Search for documents....
$ curl localhost:9200/products/_search?q=welcome
mercredi 3 juillet 13
Add a node...
$ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node2
...[cluster.service] [Node2] detected_master [Node1] ...
mercredi 3 juillet 13
Add a node...
$ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node2
...[cluster.service] [Node2] detected_master [Node1] ...
mercredi 3 juillet 13
Add another node...
$ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node3
...[cluster.service] [Node3] detected_master [Node1] ...
mercredi 3 juillet 13
Add another node...
$ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node3
...[cluster.service] [Node3] detected_master [Node1] ...
mercredi 3 juillet 13
Add another node...
$ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node3
...[cluster.service] [Node3] detected_master [Node1] ...
"index.routing.allocation.exclude.name" : "Node1"
"cluster.routing.allocation.exclude.name" : "Node3"
mercredi 3 juillet 13
mercredi 3 juillet 13
Until you know what to tweak...
mercredi 3 juillet 13
Search & Find
mercredi 3 juillet 13
Terms
apple
apple iphone
Phrases "apple iphone"
Proximity "apple safari"~5
Fuzzy apple~0.8
Wildcards
app*
*pp*
Boosting apple^10 safari
Range
[2011/05/01 TO 2011/05/31]
[java TO json]
Boolean
apple AND NOT iphone
+apple -iphone
(apple OR iphone) AND NOT review
Fields
title:iphone^15 OR body:iphone
published_on:[2011/05/01 TO "2011/05/27 10:00:00"]
http://lucene.apache.org/java/3_1_0/queryparsersyntax.html
$ curl -XGET "http://localhost:9200/_search?q=<YOUR QUERY>"
mercredi 3 juillet 13
JSON-based Query DSL
curl -XGET localhost:9200/articles/_search -d '{
"query" : {
"filtered" : {
"query" : {
"bool" : {
"must" : {
"match" : {
"author.first_name" : {
"query" : "claire",
"fuzziness" : 0.1
}
}
},
"must" : {
"multi_match" : {
"query" : "elasticsearch",
"fields" : ["title^10", "body"]
}
}
}
},
"filter": {
"and" : [
{ "terms" : { "tags" : ["search"] } },
{ "range" : { "published_on": {"from": "2013"} } },
{ "term" : { "featured" : true } }
]
}
}
}
}'
mercredi 3 juillet 13
JSON-based Query DSL
curl -XGET localhost:9200/articles/_search -d '{
"query" : {
"filtered" : {
"query" : {
"bool" : {
"must" : {
"match" : {
"author.first_name" : {
"query" : "claire",
"fuzziness" : 0.1
}
}
},
"must" : {
"multi_match" : {
"query" : "elasticsearch",
"fields" : ["title^10", "body"]
}
}
}
},
"filter": {
"and" : [
{ "terms" : { "tags" : ["search"] } },
{ "range" : { "published_on": {"from": "2013"} } },
{ "term" : { "featured" : true } }
]
}
}
}
}'
mercredi 3 juillet 13
curl -XGET localhost:9200/articles/_search -d '{
"query" : {
"filtered" : {
"query" : {
"bool" : {
"must" : {
"match" : {
"author.first_name" : {
"query" : "claire",
"fuzziness" : 0.1
}
}
},
"must" : {
"multi_match" : {
"query" : "elasticsearch",
"fields" : ["title^10", "body"]
}
}
}
},
"filter": {
"and" : [
{ "terms" : { "tags" : ["search"] } },
{ "range" : { "published_on": {"from": "2013"} } },
{ "term" : { "featured" : true } }
]
}
}
}
}'
JSON-based Query DSL
mercredi 3 juillet 13
JSON-based Query DSL
curl -XGET localhost:9200/articles/_search -d '{
"query" : {
"filtered" : {
"query" : {
"bool" : {
"must" : {
"match" : {
"author.first_name" : {
"query" : "claire",
"fuzziness" : 0.1
}
}
},
"must" : {
"multi_match" : {
"query" : "elasticsearch",
"fields" : ["title^10", "body"]
}
}
}
},
"filter": {
"and" : [
{ "terms" : { "tags" : ["search"] } },
{ "range" : { "published_on": {"from": "2013"} } },
{ "term" : { "featured" : true } }
]
}
}
}
}'
mercredi 3 juillet 13
JSON-based Query DSL
curl -XGET localhost:9200/articles/_search -d '{
"query" : {
"filtered" : {
"query" : {
"bool" : {
"must" : {
"match" : {
"author.first_name" : {
"query" : "claire",
"fuzziness" : 0.1
}
}
},
"must" : {
"multi_match" : {
"query" : "elasticsearch",
"fields" : ["title^10", "body"]
}
}
}
},
"filter": {
"and" : [
{ "terms" : { "tags" : ["search"] } },
{ "range" : { "published_on": {"from": "2013"} } },
{ "term" : { "featured" : true } }
]
}
}
}
}'
mercredi 3 juillet 13
“Find all articles with ‘search’ in their title or body, give
matches in titles higher score”
Full-text Search
“Find all articles from year 2013 tagged ‘search’”
Structured Search
See custom_score and custom_filters_score queries
Custom Scoring
“Find all articles with ‘search’ in their title or body, give
matches in titles higher score and filter articles from year 2013
tagged ‘search’ “
Combined Search
mercredi 3 juillet 13
What is really a search engine?
mercredi 3 juillet 13
What is really a search engine?
mercredi 3 juillet 13
Fetch document field ➝ Pick configured analyzer ➝ Parse
text into tokens ➝ Apply token filters ➝ Store into index
What is really a search engine?
mercredi 3 juillet 13
The _analyze API
_analyze?text=...&tokenizer=X&filters=A,B,C
mercredi 3 juillet 13
curl 'localhost:9200/_analyze?pretty&tokenizer=keyword&filters=lowercase' 
-d 'This is a Test'
The _analyze API
_analyze?text=...&tokenizer=X&filters=A,B,C
mercredi 3 juillet 13
curl 'localhost:9200/_analyze?pretty&tokenizer=keyword&filters=lowercase' 
-d 'This is a Test'
The _analyze API
{
"tokens" : [ {
"token" : "this is a test",
"start_offset" : 0, "end_offset" : 14,
"type" : "word", "position" : 1
} ]
}
_analyze?text=...&tokenizer=X&filters=A,B,C
mercredi 3 juillet 13
curl 'localhost:9200/_analyze?pretty&tokenizer=keyword&filters=lowercase' 
-d 'This is a Test'
The _analyze API
{
"tokens" : [ {
"token" : "this is a test",
"start_offset" : 0, "end_offset" : 14,
"type" : "word", "position" : 1
} ]
}
_analyze?text=...&tokenizer=X&filters=A,B,C
curl 'localhost:9200/_analyze?pretty&analyzer=standard' -d 'This is a Test'
mercredi 3 juillet 13
curl 'localhost:9200/_analyze?pretty&tokenizer=keyword&filters=lowercase' 
-d 'This is a Test'
The _analyze API
{
"tokens" : [ {
"token" : "this is a test",
"start_offset" : 0, "end_offset" : 14,
"type" : "word", "position" : 1
} ]
}
_analyze?text=...&tokenizer=X&filters=A,B,C
curl 'localhost:9200/_analyze?pretty&analyzer=standard' -d 'This is a Test'
{
"tokens" : [ {
"token" : "test",
"start_offset" : 10, "end_offset" : 14,
"type" : "<ALPHANUM>", "position" : 4
} ]
}
mercredi 3 juillet 13
Mapping
curl -XPUT localhost:9200/articles/_mapping -d '{
"article" : {
"properties" : {
"title" : {
"type" : "string",
"analyzer" : "french"
}
}
}
}'
Configuring document properties for the search engine
mercredi 3 juillet 13
Slice & Dice
mercredi 3 juillet 13
Query
Facets
mercredi 3 juillet 13
Location
Product
Tim
e
OLAP Cube
Dimensions, measures, aggregations
mercredi 3 juillet 13
Slice Dice Drill Down / Roll Up
Show me sales numbers for all products across all locations in year 2013
Show me product A sales numbers across all locations over all years
Show me products sales numbers in location X over all years
mercredi 3 juillet 13
curl -XPOST 'localhost:9200/articles/_search?search_type=count&pretty' -d '{
"facets": {
"tag-cloug": {
"terms" : {
"field" : "tags"
}
}
}
}'
“Tag Cloud” With the terms Facet
"facets" : {
"tag-cloug" : {
"terms" : [ {
"term" : "ruby",
"count" : 3
}, {
"term" : "java",
"count" : 2
},
...
} ]
}
}
Simplest “map/reduce” aggregation: document count per tag
mercredi 3 juillet 13
curl -XGET 'localhost:9200/scores/_search/?search_type=count&pretty' -d '{
"facets": {
"scores-per-subject" : {
"terms_stats" : {
"key_field" : "subject",
"value_field" : "score"
}
}
}
}'
Statistics on Student Scores With the terms_stats Facet
"facets" : {
"scores-per-subject" : {
"_type" : "terms_stats",
"missing" : 0,
"terms" : [ {
"term" : "math",
"count" : 4,
"total_count" : 4,
"min" : 25.0,
"max" : 92.0,
"total" : 267.0,
"mean" : 66.75
}, ... ]
}
}
Aggregating statistics per subject
mercredi 3 juillet 13
curl -X GET 'localhost:9200/demo-scores/_search/?search_type=count&pretty'
'{
"query" : {
"match" : {
"student" : "john"
}
},
"facets": {
"scores-per-subject" : {
"terms_stats" : {
"key_field" : "subject",
"value_field" : "score"
}
}
}
}'
Statistics on Student Scores With the terms_stats Facet
"facets" : {
"scores-per-subject" : {
"_type" : "terms_stats",
"missing" : 0,
"terms" : [ {
"term" : "math",
"count" : 1,
"total_count" : 1,
"min" : 85.0,
"max" : 85.0,
"total" : 85.0,
"mean" : 85.0
}, ... ]
}
}
Realtime filtering with queries and filters
mercredi 3 juillet 13
Facets
Terms
Terms Stats
Statistical
Range
Histogram
Date Histogram
Filter
Query
Geo Distance
mercredi 3 juillet 13
Above
& 
Beyond
mercredi 3 juillet 13
Above & Beyond
Bulk operations (For indexing and search operations)
Percolator (“reversed search” — alerts, classification, …)
Suggesters (“Did you mean …?”)
Index aliases (Grouping, filtering or “renaming” of indices)
Index templates (Automatic index configuration)
Monitoring API (Amount of memory used, number of operations, …)
…
mercredi 3 juillet 13
Above & Beyond
Bulk operations (For indexing and search operations)
Percolator (“reversed search” — alerts, classification, …)
Suggesters (“Did you mean …?”)
Index aliases (Grouping, filtering or “renaming” of indices)
Index templates (Automatic index configuration)
Monitoring API (Amount of memory used, number of operations, …)
…
GUI?
Give Kibana a try
http://three.kibana.org/
mercredi 3 juillet 13
thanks!
David Pilato
@dadoonet
mercredi 3 juillet 13

More Related Content

What's hot

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
 
ElasticSearch in action
ElasticSearch in actionElasticSearch in action
ElasticSearch in actionCodemotion
 
Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseAlexandre Rafalovitch
 
Cool bonsai cool - an introduction to ElasticSearch
Cool bonsai cool - an introduction to ElasticSearchCool bonsai cool - an introduction to ElasticSearch
Cool bonsai cool - an introduction to ElasticSearchclintongormley
 
Introduction to Elasticsearch with basics of Lucene
Introduction to Elasticsearch with basics of LuceneIntroduction to Elasticsearch with basics of Lucene
Introduction to Elasticsearch with basics of LuceneRahul Jain
 
Query DSL In Elasticsearch
Query DSL In ElasticsearchQuery DSL In Elasticsearch
Query DSL In ElasticsearchKnoldus Inc.
 
ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch - DevNexus Atlanta - 2014ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch - DevNexus Atlanta - 2014Roy Russo
 
Intro to Elasticsearch
Intro to ElasticsearchIntro to Elasticsearch
Intro to ElasticsearchClifford James
 
Managing Your Content with Elasticsearch
Managing Your Content with ElasticsearchManaging Your Content with Elasticsearch
Managing Your Content with ElasticsearchSamantha Quiñones
 
Elasticsearch for Data Analytics
Elasticsearch for Data AnalyticsElasticsearch for Data Analytics
Elasticsearch for Data AnalyticsFelipe
 
Elastic search apache_solr
Elastic search apache_solrElastic search apache_solr
Elastic search apache_solrmacrochen
 
Elastic search overview
Elastic search overviewElastic search overview
Elastic search overviewABC Talks
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersBen van Mol
 
Philly PHP: April '17 Elastic Search Introduction by Aditya Bhamidpati
Philly PHP: April '17 Elastic Search Introduction by Aditya BhamidpatiPhilly PHP: April '17 Elastic Search Introduction by Aditya Bhamidpati
Philly PHP: April '17 Elastic Search Introduction by Aditya BhamidpatiRobert Calcavecchia
 
What I learnt: Elastic search & Kibana : introduction, installtion & configur...
What I learnt: Elastic search & Kibana : introduction, installtion & configur...What I learnt: Elastic search & Kibana : introduction, installtion & configur...
What I learnt: Elastic search & Kibana : introduction, installtion & configur...Rahul K Chauhan
 
Elastic Search
Elastic SearchElastic Search
Elastic SearchNavule Rao
 
Intro to elasticsearch
Intro to elasticsearchIntro to elasticsearch
Intro to elasticsearchJoey Wen
 

What's hot (20)

Elasticsearch Introduction at BigData meetup
Elasticsearch Introduction at BigData meetupElasticsearch Introduction at BigData meetup
Elasticsearch Introduction at BigData meetup
 
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!
 
ElasticSearch in action
ElasticSearch in actionElasticSearch in action
ElasticSearch in action
 
Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by Case
 
Cool bonsai cool - an introduction to ElasticSearch
Cool bonsai cool - an introduction to ElasticSearchCool bonsai cool - an introduction to ElasticSearch
Cool bonsai cool - an introduction to ElasticSearch
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
Introduction to Elasticsearch with basics of Lucene
Introduction to Elasticsearch with basics of LuceneIntroduction to Elasticsearch with basics of Lucene
Introduction to Elasticsearch with basics of Lucene
 
Query DSL In Elasticsearch
Query DSL In ElasticsearchQuery DSL In Elasticsearch
Query DSL In Elasticsearch
 
ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch - DevNexus Atlanta - 2014ElasticSearch - DevNexus Atlanta - 2014
ElasticSearch - DevNexus Atlanta - 2014
 
Intro to Elasticsearch
Intro to ElasticsearchIntro to Elasticsearch
Intro to Elasticsearch
 
Managing Your Content with Elasticsearch
Managing Your Content with ElasticsearchManaging Your Content with Elasticsearch
Managing Your Content with Elasticsearch
 
Elasticsearch for Data Analytics
Elasticsearch for Data AnalyticsElasticsearch for Data Analytics
Elasticsearch for Data Analytics
 
Elastic search apache_solr
Elastic search apache_solrElastic search apache_solr
Elastic search apache_solr
 
Elastic search overview
Elastic search overviewElastic search overview
Elastic search overview
 
Elasticsearch Introduction
Elasticsearch IntroductionElasticsearch Introduction
Elasticsearch Introduction
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET Developers
 
Philly PHP: April '17 Elastic Search Introduction by Aditya Bhamidpati
Philly PHP: April '17 Elastic Search Introduction by Aditya BhamidpatiPhilly PHP: April '17 Elastic Search Introduction by Aditya Bhamidpati
Philly PHP: April '17 Elastic Search Introduction by Aditya Bhamidpati
 
What I learnt: Elastic search & Kibana : introduction, installtion & configur...
What I learnt: Elastic search & Kibana : introduction, installtion & configur...What I learnt: Elastic search & Kibana : introduction, installtion & configur...
What I learnt: Elastic search & Kibana : introduction, installtion & configur...
 
Elastic Search
Elastic SearchElastic Search
Elastic Search
 
Intro to elasticsearch
Intro to elasticsearchIntro to elasticsearch
Intro to elasticsearch
 

Similar to Elasticsearch in 15 minutes

Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 MinutesKarel Minarik
 
elasticsearch basics workshop
elasticsearch basics workshopelasticsearch basics workshop
elasticsearch basics workshopMathieu Elie
 
Elasticsearch – mye mer enn søk! [JavaZone 2013]
Elasticsearch – mye mer enn søk! [JavaZone 2013]Elasticsearch – mye mer enn søk! [JavaZone 2013]
Elasticsearch – mye mer enn søk! [JavaZone 2013]foundsearch
 
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 2017Codemotion
 
Real-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @MoldcampReal-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @MoldcampAlexei Gorobets
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"George Stathis
 
Finding the right stuff, an intro to Elasticsearch (at Rug::B)
Finding the right stuff, an intro to Elasticsearch (at Rug::B) Finding the right stuff, an intro to Elasticsearch (at Rug::B)
Finding the right stuff, an intro to Elasticsearch (at Rug::B) Michael Reinsch
 
Elastic search and Symfony3 - A practical approach
Elastic search and Symfony3 - A practical approachElastic search and Symfony3 - A practical approach
Elastic search and Symfony3 - A practical approachSymfonyMu
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)Pat Patterson
 
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
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用LearningTech
 
Elasticsearch intro output
Elasticsearch intro outputElasticsearch intro output
Elasticsearch intro outputTom Chen
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and PythonPiXeL16
 
Overview of GraphQL & Clients
Overview of GraphQL & ClientsOverview of GraphQL & Clients
Overview of GraphQL & ClientsPokai Chang
 
Stop the noise! - Introduction to the JSON:API specification in Drupal
Stop the noise! - Introduction to the JSON:API specification in DrupalStop the noise! - Introduction to the JSON:API specification in Drupal
Stop the noise! - Introduction to the JSON:API specification in DrupalBjörn Brala
 
GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑Pokai Chang
 
Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !Microsoft
 
Finding the right stuff, an intro to Elasticsearch with Ruby/Rails
Finding the right stuff, an intro to Elasticsearch with Ruby/RailsFinding the right stuff, an intro to Elasticsearch with Ruby/Rails
Finding the right stuff, an intro to Elasticsearch with Ruby/RailsMichael Reinsch
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to ElasticsearchRuslan Zavacky
 

Similar to Elasticsearch in 15 minutes (20)

Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 Minutes
 
elasticsearch basics workshop
elasticsearch basics workshopelasticsearch basics workshop
elasticsearch basics workshop
 
Elasticsearch – mye mer enn søk! [JavaZone 2013]
Elasticsearch – mye mer enn søk! [JavaZone 2013]Elasticsearch – mye mer enn søk! [JavaZone 2013]
Elasticsearch – mye mer enn søk! [JavaZone 2013]
 
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
 
Real-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @MoldcampReal-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @Moldcamp
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"
 
JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
 
Finding the right stuff, an intro to Elasticsearch (at Rug::B)
Finding the right stuff, an intro to Elasticsearch (at Rug::B) Finding the right stuff, an intro to Elasticsearch (at Rug::B)
Finding the right stuff, an intro to Elasticsearch (at Rug::B)
 
Elastic search and Symfony3 - A practical approach
Elastic search and Symfony3 - A practical approachElastic search and Symfony3 - A practical approach
Elastic search and Symfony3 - A practical approach
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
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...
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
 
Elasticsearch intro output
Elasticsearch intro outputElasticsearch intro output
Elasticsearch intro output
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
 
Overview of GraphQL & Clients
Overview of GraphQL & ClientsOverview of GraphQL & Clients
Overview of GraphQL & Clients
 
Stop the noise! - Introduction to the JSON:API specification in Drupal
Stop the noise! - Introduction to the JSON:API specification in DrupalStop the noise! - Introduction to the JSON:API specification in Drupal
Stop the noise! - Introduction to the JSON:API specification in Drupal
 
GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑
 
Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !
 
Finding the right stuff, an intro to Elasticsearch with Ruby/Rails
Finding the right stuff, an intro to Elasticsearch with Ruby/RailsFinding the right stuff, an intro to Elasticsearch with Ruby/Rails
Finding the right stuff, an intro to Elasticsearch with Ruby/Rails
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 

More from David Pilato

2018-10-02 - Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouv...
2018-10-02 - Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouv...2018-10-02 - Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouv...
2018-10-02 - Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouv...David Pilato
 
Managing your black friday logs Voxxed Luxembourg
Managing your black friday logs Voxxed LuxembourgManaging your black friday logs Voxxed Luxembourg
Managing your black friday logs Voxxed LuxembourgDavid Pilato
 
Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouver...
Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouver...Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouver...
Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouver...David Pilato
 
Managing your Black Friday Logs NDC Oslo
Managing your  Black Friday Logs NDC OsloManaging your  Black Friday Logs NDC Oslo
Managing your Black Friday Logs NDC OsloDavid Pilato
 
Managing your black friday logs - Code Europe
Managing your black friday logs - Code EuropeManaging your black friday logs - Code Europe
Managing your black friday logs - Code EuropeDavid Pilato
 
Managing your black Friday logs - CloudConf.IT
Managing your black Friday logs - CloudConf.ITManaging your black Friday logs - CloudConf.IT
Managing your black Friday logs - CloudConf.ITDavid Pilato
 
Elastify you application: from SQL to NoSQL in less than one hour!
Elastify you application: from SQL to NoSQL in less than one hour!Elastify you application: from SQL to NoSQL in less than one hour!
Elastify you application: from SQL to NoSQL in less than one hour!David Pilato
 
Elasticsearch - Esme sudria
Elasticsearch - Esme sudriaElasticsearch - Esme sudria
Elasticsearch - Esme sudriaDavid Pilato
 
Lausanne JUG - Elasticsearch
Lausanne JUG - ElasticsearchLausanne JUG - Elasticsearch
Lausanne JUG - ElasticsearchDavid Pilato
 
Normandy JUG - Elasticsearch
Normandy JUG - ElasticsearchNormandy JUG - Elasticsearch
Normandy JUG - ElasticsearchDavid Pilato
 
Paris data geek - Elasticsearch
Paris data geek - ElasticsearchParis data geek - Elasticsearch
Paris data geek - ElasticsearchDavid Pilato
 
Nantes JUG - Elasticsearch
Nantes JUG - ElasticsearchNantes JUG - Elasticsearch
Nantes JUG - ElasticsearchDavid Pilato
 
Finist JUG - Elasticsearch
Finist JUG - ElasticsearchFinist JUG - Elasticsearch
Finist JUG - ElasticsearchDavid Pilato
 
Poitou charentes JUG - Elasticsearch
Poitou charentes JUG - ElasticsearchPoitou charentes JUG - Elasticsearch
Poitou charentes JUG - ElasticsearchDavid Pilato
 
Elasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUGElasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUGDavid Pilato
 
Lyon JUG - Elasticsearch
Lyon JUG - ElasticsearchLyon JUG - Elasticsearch
Lyon JUG - ElasticsearchDavid Pilato
 
Elasticsearch - OSDC France 2012
Elasticsearch - OSDC France 2012Elasticsearch - OSDC France 2012
Elasticsearch - OSDC France 2012David Pilato
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab ElasticsearchDavid Pilato
 
Elasticsearch - Devoxx France 2012 - English version
Elasticsearch - Devoxx France 2012 - English versionElasticsearch - Devoxx France 2012 - English version
Elasticsearch - Devoxx France 2012 - English versionDavid Pilato
 
Elasticsearch - Devoxx France 2012
Elasticsearch - Devoxx France 2012Elasticsearch - Devoxx France 2012
Elasticsearch - Devoxx France 2012David Pilato
 

More from David Pilato (20)

2018-10-02 - Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouv...
2018-10-02 - Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouv...2018-10-02 - Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouv...
2018-10-02 - Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouv...
 
Managing your black friday logs Voxxed Luxembourg
Managing your black friday logs Voxxed LuxembourgManaging your black friday logs Voxxed Luxembourg
Managing your black friday logs Voxxed Luxembourg
 
Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouver...
Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouver...Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouver...
Un moteur de recherche NoSQL pour chercher^H^H^H^H^H^H^H^H trouver...
 
Managing your Black Friday Logs NDC Oslo
Managing your  Black Friday Logs NDC OsloManaging your  Black Friday Logs NDC Oslo
Managing your Black Friday Logs NDC Oslo
 
Managing your black friday logs - Code Europe
Managing your black friday logs - Code EuropeManaging your black friday logs - Code Europe
Managing your black friday logs - Code Europe
 
Managing your black Friday logs - CloudConf.IT
Managing your black Friday logs - CloudConf.ITManaging your black Friday logs - CloudConf.IT
Managing your black Friday logs - CloudConf.IT
 
Elastify you application: from SQL to NoSQL in less than one hour!
Elastify you application: from SQL to NoSQL in less than one hour!Elastify you application: from SQL to NoSQL in less than one hour!
Elastify you application: from SQL to NoSQL in less than one hour!
 
Elasticsearch - Esme sudria
Elasticsearch - Esme sudriaElasticsearch - Esme sudria
Elasticsearch - Esme sudria
 
Lausanne JUG - Elasticsearch
Lausanne JUG - ElasticsearchLausanne JUG - Elasticsearch
Lausanne JUG - Elasticsearch
 
Normandy JUG - Elasticsearch
Normandy JUG - ElasticsearchNormandy JUG - Elasticsearch
Normandy JUG - Elasticsearch
 
Paris data geek - Elasticsearch
Paris data geek - ElasticsearchParis data geek - Elasticsearch
Paris data geek - Elasticsearch
 
Nantes JUG - Elasticsearch
Nantes JUG - ElasticsearchNantes JUG - Elasticsearch
Nantes JUG - Elasticsearch
 
Finist JUG - Elasticsearch
Finist JUG - ElasticsearchFinist JUG - Elasticsearch
Finist JUG - Elasticsearch
 
Poitou charentes JUG - Elasticsearch
Poitou charentes JUG - ElasticsearchPoitou charentes JUG - Elasticsearch
Poitou charentes JUG - Elasticsearch
 
Elasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUGElasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUG
 
Lyon JUG - Elasticsearch
Lyon JUG - ElasticsearchLyon JUG - Elasticsearch
Lyon JUG - Elasticsearch
 
Elasticsearch - OSDC France 2012
Elasticsearch - OSDC France 2012Elasticsearch - OSDC France 2012
Elasticsearch - OSDC France 2012
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab Elasticsearch
 
Elasticsearch - Devoxx France 2012 - English version
Elasticsearch - Devoxx France 2012 - English versionElasticsearch - Devoxx France 2012 - English version
Elasticsearch - Devoxx France 2012 - English version
 
Elasticsearch - Devoxx France 2012
Elasticsearch - Devoxx France 2012Elasticsearch - Devoxx France 2012
Elasticsearch - Devoxx France 2012
 

Recently uploaded

COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 

Recently uploaded (20)

COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 

Elasticsearch in 15 minutes

  • 1. David Pilato @dadoonet elasticsearch in 15 minutes mercredi 3 juillet 13
  • 2. Elasticsearch.com • Créée en 2012 par les auteurs d’Elasticsearch • Formation (publique et intra) • Consulting (support dév) • Abonnement annuel support pour la production avec 3 niveaux de SLA mercredi 3 juillet 13
  • 4. Installation $ wget https://download.elasticsearch.org/... $ tar -xf elasticsearch-0.90.2.tar.gz $ ./elasticsearch-0.90.2/bin/elasticsearch -f ... [INFO ][node][Ghost Maker] {0.90.2}[5645]: initializing ... mercredi 3 juillet 13
  • 5. Index a document... $ curl -XPUT localhost:9200/products/product/1 -d '{ "title" : "Welcome!" }' mercredi 3 juillet 13
  • 6. Update a document... $ curl -XPUT localhost:9200/products/product/1 -d '{ "title" : "Welcome to the Elasticsearch meetup!" }' mercredi 3 juillet 13
  • 7. { "id" : "abc123", "title" : "A JSON Document", "body" : "A JSON document is a ...", "published_on" : "2013/06/27 10:00:00", "featured" : true, "tags" : ["search", "json"], "author" : { "first_name" : "Clara", "last_name" : "Rice", "email" : "clara@rice.org" } } Documents as JSON Data structure with basic types, arrays and deep hierarchies mercredi 3 juillet 13
  • 8. Search for documents.... $ curl localhost:9200/products/_search?q=welcome mercredi 3 juillet 13
  • 9. Add a node... $ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node2 ...[cluster.service] [Node2] detected_master [Node1] ... mercredi 3 juillet 13
  • 10. Add a node... $ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node2 ...[cluster.service] [Node2] detected_master [Node1] ... mercredi 3 juillet 13
  • 11. Add another node... $ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node3 ...[cluster.service] [Node3] detected_master [Node1] ... mercredi 3 juillet 13
  • 12. Add another node... $ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node3 ...[cluster.service] [Node3] detected_master [Node1] ... mercredi 3 juillet 13
  • 13. Add another node... $ ./elasticsearch-0.90.2/bin/elasticsearch -f -D es.node.name=Node3 ...[cluster.service] [Node3] detected_master [Node1] ... "index.routing.allocation.exclude.name" : "Node1" "cluster.routing.allocation.exclude.name" : "Node3" mercredi 3 juillet 13
  • 15. Until you know what to tweak... mercredi 3 juillet 13
  • 17. Terms apple apple iphone Phrases "apple iphone" Proximity "apple safari"~5 Fuzzy apple~0.8 Wildcards app* *pp* Boosting apple^10 safari Range [2011/05/01 TO 2011/05/31] [java TO json] Boolean apple AND NOT iphone +apple -iphone (apple OR iphone) AND NOT review Fields title:iphone^15 OR body:iphone published_on:[2011/05/01 TO "2011/05/27 10:00:00"] http://lucene.apache.org/java/3_1_0/queryparsersyntax.html $ curl -XGET "http://localhost:9200/_search?q=<YOUR QUERY>" mercredi 3 juillet 13
  • 18. JSON-based Query DSL curl -XGET localhost:9200/articles/_search -d '{ "query" : { "filtered" : { "query" : { "bool" : { "must" : { "match" : { "author.first_name" : { "query" : "claire", "fuzziness" : 0.1 } } }, "must" : { "multi_match" : { "query" : "elasticsearch", "fields" : ["title^10", "body"] } } } }, "filter": { "and" : [ { "terms" : { "tags" : ["search"] } }, { "range" : { "published_on": {"from": "2013"} } }, { "term" : { "featured" : true } } ] } } } }' mercredi 3 juillet 13
  • 19. JSON-based Query DSL curl -XGET localhost:9200/articles/_search -d '{ "query" : { "filtered" : { "query" : { "bool" : { "must" : { "match" : { "author.first_name" : { "query" : "claire", "fuzziness" : 0.1 } } }, "must" : { "multi_match" : { "query" : "elasticsearch", "fields" : ["title^10", "body"] } } } }, "filter": { "and" : [ { "terms" : { "tags" : ["search"] } }, { "range" : { "published_on": {"from": "2013"} } }, { "term" : { "featured" : true } } ] } } } }' mercredi 3 juillet 13
  • 20. curl -XGET localhost:9200/articles/_search -d '{ "query" : { "filtered" : { "query" : { "bool" : { "must" : { "match" : { "author.first_name" : { "query" : "claire", "fuzziness" : 0.1 } } }, "must" : { "multi_match" : { "query" : "elasticsearch", "fields" : ["title^10", "body"] } } } }, "filter": { "and" : [ { "terms" : { "tags" : ["search"] } }, { "range" : { "published_on": {"from": "2013"} } }, { "term" : { "featured" : true } } ] } } } }' JSON-based Query DSL mercredi 3 juillet 13
  • 21. JSON-based Query DSL curl -XGET localhost:9200/articles/_search -d '{ "query" : { "filtered" : { "query" : { "bool" : { "must" : { "match" : { "author.first_name" : { "query" : "claire", "fuzziness" : 0.1 } } }, "must" : { "multi_match" : { "query" : "elasticsearch", "fields" : ["title^10", "body"] } } } }, "filter": { "and" : [ { "terms" : { "tags" : ["search"] } }, { "range" : { "published_on": {"from": "2013"} } }, { "term" : { "featured" : true } } ] } } } }' mercredi 3 juillet 13
  • 22. JSON-based Query DSL curl -XGET localhost:9200/articles/_search -d '{ "query" : { "filtered" : { "query" : { "bool" : { "must" : { "match" : { "author.first_name" : { "query" : "claire", "fuzziness" : 0.1 } } }, "must" : { "multi_match" : { "query" : "elasticsearch", "fields" : ["title^10", "body"] } } } }, "filter": { "and" : [ { "terms" : { "tags" : ["search"] } }, { "range" : { "published_on": {"from": "2013"} } }, { "term" : { "featured" : true } } ] } } } }' mercredi 3 juillet 13
  • 23. “Find all articles with ‘search’ in their title or body, give matches in titles higher score” Full-text Search “Find all articles from year 2013 tagged ‘search’” Structured Search See custom_score and custom_filters_score queries Custom Scoring “Find all articles with ‘search’ in their title or body, give matches in titles higher score and filter articles from year 2013 tagged ‘search’ “ Combined Search mercredi 3 juillet 13
  • 24. What is really a search engine? mercredi 3 juillet 13
  • 25. What is really a search engine? mercredi 3 juillet 13
  • 26. Fetch document field ➝ Pick configured analyzer ➝ Parse text into tokens ➝ Apply token filters ➝ Store into index What is really a search engine? mercredi 3 juillet 13
  • 28. curl 'localhost:9200/_analyze?pretty&tokenizer=keyword&filters=lowercase' -d 'This is a Test' The _analyze API _analyze?text=...&tokenizer=X&filters=A,B,C mercredi 3 juillet 13
  • 29. curl 'localhost:9200/_analyze?pretty&tokenizer=keyword&filters=lowercase' -d 'This is a Test' The _analyze API { "tokens" : [ { "token" : "this is a test", "start_offset" : 0, "end_offset" : 14, "type" : "word", "position" : 1 } ] } _analyze?text=...&tokenizer=X&filters=A,B,C mercredi 3 juillet 13
  • 30. curl 'localhost:9200/_analyze?pretty&tokenizer=keyword&filters=lowercase' -d 'This is a Test' The _analyze API { "tokens" : [ { "token" : "this is a test", "start_offset" : 0, "end_offset" : 14, "type" : "word", "position" : 1 } ] } _analyze?text=...&tokenizer=X&filters=A,B,C curl 'localhost:9200/_analyze?pretty&analyzer=standard' -d 'This is a Test' mercredi 3 juillet 13
  • 31. curl 'localhost:9200/_analyze?pretty&tokenizer=keyword&filters=lowercase' -d 'This is a Test' The _analyze API { "tokens" : [ { "token" : "this is a test", "start_offset" : 0, "end_offset" : 14, "type" : "word", "position" : 1 } ] } _analyze?text=...&tokenizer=X&filters=A,B,C curl 'localhost:9200/_analyze?pretty&analyzer=standard' -d 'This is a Test' { "tokens" : [ { "token" : "test", "start_offset" : 10, "end_offset" : 14, "type" : "<ALPHANUM>", "position" : 4 } ] } mercredi 3 juillet 13
  • 32. Mapping curl -XPUT localhost:9200/articles/_mapping -d '{ "article" : { "properties" : { "title" : { "type" : "string", "analyzer" : "french" } } } }' Configuring document properties for the search engine mercredi 3 juillet 13
  • 35. Location Product Tim e OLAP Cube Dimensions, measures, aggregations mercredi 3 juillet 13
  • 36. Slice Dice Drill Down / Roll Up Show me sales numbers for all products across all locations in year 2013 Show me product A sales numbers across all locations over all years Show me products sales numbers in location X over all years mercredi 3 juillet 13
  • 37. curl -XPOST 'localhost:9200/articles/_search?search_type=count&pretty' -d '{ "facets": { "tag-cloug": { "terms" : { "field" : "tags" } } } }' “Tag Cloud” With the terms Facet "facets" : { "tag-cloug" : { "terms" : [ { "term" : "ruby", "count" : 3 }, { "term" : "java", "count" : 2 }, ... } ] } } Simplest “map/reduce” aggregation: document count per tag mercredi 3 juillet 13
  • 38. curl -XGET 'localhost:9200/scores/_search/?search_type=count&pretty' -d '{ "facets": { "scores-per-subject" : { "terms_stats" : { "key_field" : "subject", "value_field" : "score" } } } }' Statistics on Student Scores With the terms_stats Facet "facets" : { "scores-per-subject" : { "_type" : "terms_stats", "missing" : 0, "terms" : [ { "term" : "math", "count" : 4, "total_count" : 4, "min" : 25.0, "max" : 92.0, "total" : 267.0, "mean" : 66.75 }, ... ] } } Aggregating statistics per subject mercredi 3 juillet 13
  • 39. curl -X GET 'localhost:9200/demo-scores/_search/?search_type=count&pretty' '{ "query" : { "match" : { "student" : "john" } }, "facets": { "scores-per-subject" : { "terms_stats" : { "key_field" : "subject", "value_field" : "score" } } } }' Statistics on Student Scores With the terms_stats Facet "facets" : { "scores-per-subject" : { "_type" : "terms_stats", "missing" : 0, "terms" : [ { "term" : "math", "count" : 1, "total_count" : 1, "min" : 85.0, "max" : 85.0, "total" : 85.0, "mean" : 85.0 }, ... ] } } Realtime filtering with queries and filters mercredi 3 juillet 13
  • 42. Above & Beyond Bulk operations (For indexing and search operations) Percolator (“reversed search” — alerts, classification, …) Suggesters (“Did you mean …?”) Index aliases (Grouping, filtering or “renaming” of indices) Index templates (Automatic index configuration) Monitoring API (Amount of memory used, number of operations, …) … mercredi 3 juillet 13
  • 43. Above & Beyond Bulk operations (For indexing and search operations) Percolator (“reversed search” — alerts, classification, …) Suggesters (“Did you mean …?”) Index aliases (Grouping, filtering or “renaming” of indices) Index templates (Automatic index configuration) Monitoring API (Amount of memory used, number of operations, …) … GUI? Give Kibana a try http://three.kibana.org/ mercredi 3 juillet 13