SlideShare a Scribd company logo
Drupal And ElasticsearchAlex Goja
Flexible and powerful open source,
distributed real-time search and
analytics engine for the cloud
Elasticsearch
Flexible and powerful open source,
distributed real-time search and
analytics engine for the cloud
Elasticsearch
RESTful API on top of Lucene library
Why use
Elasticsearch?
Why use
Elasticsearch?
● RESTful API 

● Open Source 

● JSON over HTTP 

● based on Lucene 

● distributed 

● highly available 

● schema free 

● massively scalable 

DRUPAL AND ELASTICSEARCH
How to use it?
How to use it?
> curl -XGET localhost:9200/?pretty
How to use it?
> curl -XGET localhost:9200/?pretty
{

"ok" : true,
"status" : 200, "name" : "Infinity",
"version" : {
"number" : "0.90.1",
"snapshot_build" : false,
"lucene_version" : "4.3"
},
"tagline" : "You Know, for Search"
}
How to use it?
> curl -XGET localhost:9200/?pretty
action
How to use it?
> curl -XGET localhost:9200/?pretty
node + port
How to use it?
> curl -XGET localhost:9200/?pretty
path
How to use it?
> curl -XGET localhost:9200/?pretty
query string
Let's index some data
Let's index some data
> PUT /index/type/id
Where?
It's very similar to database in SQL
Let's index some data
> PUT /index/type/id
What?
Table

Content type,

Entity type,

any kind of type you decide
Let's index some data
> PUT /index/type/id
Which?
Node ID, Entity ID,

any kind of serial ID
Let's index some data
> PUT /mysite/node/1
{

"nid": "1",
"status": "1",

"title": "Hello elasticsearch",

"body": "First elasticsearch document"
}
Let's index some data
> PUT /mysite/node/1 -d
{
"nid": "1",
"status": "1",

"title": "Hello elasticsearch",

"body": "First elasticsearch document"
}
{

"ok":true,
"_index":"mysite",
"_type":"node",
"_id":"1",
"_version":1
}
Let's GET some data
Let's GET some data
> GET /mysite/node/1
{

"_index" : "mysite",
"_type" : "node",
"_id" : "1",
"_version" : 1,
"exists" : true,
"_source" : {
"nid":"1",

"status":"1",

"title":"Hello elasticsearch”,
"body":"First elasticsearch document"
}
}
Let's GET some data
Get specific fields
> GET /mysite/node/1?fields=title,body
Get source only
> GET /mysite/node/1/_source
Let's UPDATE some
data
> PUT /mysite/node/1
{
“status":"0"
}
Let's UPDATE some
data
> PUT /mysite/node/1
{
"status":"0"
}
{

"ok":true,
"_index":"mysite",
"_type":"node",
"_id":"1",
"_version":2
}
Let's DELETE some
data
Let's DELETE some
data
> DELETE /mysite/node/1
Let's DELETE some
data
> DELETE /mysite/node/1
{
"ok":true,
"found":true,
"_index":"mysite",
"_type":"node",
"_id":"1",
“_version":3
}
Let's SEARCH for
something
Let's SEARCH for
something
> GET /_search
{
"took" : 32,
"timed_out" : false,
"_shards" : {
"total" : 20,
"successful" : 20,
"failed" : 0
},
"hits" : { results... }
}
Let's SEARCH in
multiple indices and
types
Let's SEARCH in
multiple indices and
types
> GET /index/_search
> GET /index1,index2/_search
> GET /index/type/_search


> GET /myapp_*/type, entity_*/_search
Let's PAGINATE
results
Let's PAGINATE
results
> GET /_search?size=10&from=20
size = results per page
from = starting from
Let's search oldschool
Let's search oldschool
> GET /_search?q=title:elasticsearch
> GET /_search?q=nid:60
Query DSL style
Query DSL style
> GET /_search?size=10&from=20
{
"query": {

“match": "awesome"
}
}
Query DSL style
> GET /_search?size=10&from=20
{

"query": {
"field" : {
"title" : {
“query" : "+awesome -poor",
"boost" : 2.0,
}
}
}
}
Queries & Filters
Queries & Filters
full text search exact match
relevance score show or hide
heavy lightning fast

not cacheable cacheable
Combine Filters &
Queries
Combine Filters &
Queries
{

"query": {
"filtered": {
"query": {
"match": {
"title": "awesome"
}
},
"filter": {

"term": {
"type": "article"
}
}
}
}
}
> GET /_search
Sorting
Sorting
{

"query": {
"filtered": {
"query": {
“match": { "title": "awesome" }
},
"filter": {

"term": { "type": "article" }
}
}
}
"sort": {"date":"desc"}
}
> GET /_search
and Facets
"aggregations" : {
"<aggregation_name>" : {
"<aggregation_type>" : {
<aggregation_body>
}
[,"meta" : { [<meta_data_body>] } ]?
[,"aggregations" : { [<sub_aggregation>]+ } ]?
}
[,"<aggregation_name_2>" : { ... } ]*
}
and Facets
> GET /_search
{
"aggregations": {
"home_team": {
"terms": {

"field": “field_home_team"
}
}
}
}
and Facets
> GET /_search
{
"aggregations": {
"home_team": {
"terms": {

"field": “field_home_team"
}
}
}
}
Give your facet a name
and Facets
> GET /_search
{
"aggregations": {
"home_team": {
"terms": {

"field": “field_home_team"
}
}
}
}
Your facet filter can be:
● Terms

● Range

● Histogram

● Date Histogram ● Filter

● Query

● Statistical

● Terms Stats

● Geo Distance

● Cardinality

● Nested
and Facets
"aggregations" : {
"home_team" : {
"_type" : "terms",
"missing" : 203,
"total" : 100,
"other" : 42,
"terms" : [ {
"term" : "hou",
"count" : 8
}, {

"term" : "sln",
"count" : 6
}, ...
STOP! I want this
in Drupal
STOP! I want this
in Drupal
Available modules:
Search API + elasticsearch_connector
Let the Search be with you

More Related Content

ODP
Elastic Search
PPT
Php Mysql
PDF
Elasticsearch in 15 Minutes
PDF
Elasticsearch And Ruby [RuPy2012]
PDF
Elasticsearch (Rubyshift 2013)
PPTX
Ch5(ms access with php)
PDF
Web Crawling Modeling with Scrapy Models #TDC2014
PDF
Analyse your SEO Data with R and Kibana
Elastic Search
Php Mysql
Elasticsearch in 15 Minutes
Elasticsearch And Ruby [RuPy2012]
Elasticsearch (Rubyshift 2013)
Ch5(ms access with php)
Web Crawling Modeling with Scrapy Models #TDC2014
Analyse your SEO Data with R and Kibana

What's hot (20)

PDF
Solr & Lucene @ Etsy by Gregg Donovan
PPTX
Elastic search Walkthrough
PDF
Simple search with elastic search
PPTX
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...
PDF
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...
PDF
Uncovering Iterators
PDF
Asynchronous I/O in PHP
PDF
Solr @ Etsy - Apache Lucene Eurocon
PDF
Not Really PHP by the book
PDF
Indexing all the things: Building your search engine in python
KEY
[Coscup 2012] JavascriptMVC
PDF
React PHP: the NodeJS challenger
PDF
Import o matic_higher_ed
PDF
Side by Side with Elasticsearch and Solr
PDF
Apache CouchDB talk at Ontario GNU Linux Fest
PDF
Living with garbage
PPTX
How to automate all your SEO projects
PPTX
How to scraping content from web for location-based mobile app.
ODP
The promise of asynchronous PHP
ODP
B03-GenomeContent-Intermine
Solr & Lucene @ Etsy by Gregg Donovan
Elastic search Walkthrough
Simple search with elastic search
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...
Uncovering Iterators
Asynchronous I/O in PHP
Solr @ Etsy - Apache Lucene Eurocon
Not Really PHP by the book
Indexing all the things: Building your search engine in python
[Coscup 2012] JavascriptMVC
React PHP: the NodeJS challenger
Import o matic_higher_ed
Side by Side with Elasticsearch and Solr
Apache CouchDB talk at Ontario GNU Linux Fest
Living with garbage
How to automate all your SEO projects
How to scraping content from web for location-based mobile app.
The promise of asynchronous PHP
B03-GenomeContent-Intermine
Ad

Similar to DRUPAL AND ELASTICSEARCH (20)

PDF
Real-time search in Drupal with Elasticsearch @Moldcamp
PDF
Real-time search in Drupal. Meet Elasticsearch
PDF
Montreal Elasticsearch Meetup
PDF
Elasticsearch sur Azure : Make sense of your (BIG) data !
PDF
Ako prepojiť aplikáciu s Elasticsearch
PDF
elasticsearch - advanced features in practice
PDF
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
PDF
Elasticsearch intro output
PPTX
Elasticsearch an overview
PDF
ElasticSearch in action
PPT
How ElasticSearch lives in my DevOps life
PDF
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
PPTX
Elastic search intro-@lamper
PDF
Rapid Prototyping with Solr
PPT
Apps for Science - Elsevier Developer Network Workshop 201102
PDF
Workshop: Learning Elasticsearch
PPTX
Elasticsearch
PDF
Rapid Prototyping with Solr
PDF
Introduction to elasticsearch
PPTX
Elasticsearch
Real-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal. Meet Elasticsearch
Montreal Elasticsearch Meetup
Elasticsearch sur Azure : Make sense of your (BIG) data !
Ako prepojiť aplikáciu s Elasticsearch
elasticsearch - advanced features in practice
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Elasticsearch intro output
Elasticsearch an overview
ElasticSearch in action
How ElasticSearch lives in my DevOps life
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Elastic search intro-@lamper
Rapid Prototyping with Solr
Apps for Science - Elsevier Developer Network Workshop 201102
Workshop: Learning Elasticsearch
Elasticsearch
Rapid Prototyping with Solr
Introduction to elasticsearch
Elasticsearch
Ad

More from DrupalCamp Kyiv (20)

PDF
Speed up the site building with Drupal's Bootstrap Layout Builder
PDF
Performance Monitoring with Google Lighthouse
PPTX
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
PDF
Acquia BLT for the Win, or How to speed up the project setup, development an...
PDF
Upgrading to Drupal 9
PDF
THE INTERNET OF THINGS IS GETTING REAL
PDF
FRONT-END COMPONENTS IN DRUPAL THEME. "KAIZEN" - DRUPAL 8 THEME FROM SKILLD
PDF
WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...
PDF
Blackfire Workshop
PDF
DRUPAL 8 STORAGES OVERVIEW
PPTX
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
DOCX
1-1 MEETING: STEP-BY-STEP-HOW-TO
PPTX
UX DURING MODULE INSTALLATION AND CONFIGURATION
PDF
SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?
PDF
TECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERA
PPTX
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
PDF
DRUPAL AUDITS MADE FASTR
PDF
FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...
PDF
SEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONS
PDF
DEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCE
Speed up the site building with Drupal's Bootstrap Layout Builder
Performance Monitoring with Google Lighthouse
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
Acquia BLT for the Win, or How to speed up the project setup, development an...
Upgrading to Drupal 9
THE INTERNET OF THINGS IS GETTING REAL
FRONT-END COMPONENTS IN DRUPAL THEME. "KAIZEN" - DRUPAL 8 THEME FROM SKILLD
WHAT WE LEARNED FROM OPEN SOCIAL IN 3 YEARS, MOVING FROM AN AGENCY TO A PRODU...
Blackfire Workshop
DRUPAL 8 STORAGES OVERVIEW
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
1-1 MEETING: STEP-BY-STEP-HOW-TO
UX DURING MODULE INSTALLATION AND CONFIGURATION
SWITCHING FROM QA ENGINEER TO PROJECT MANAGER - LEVEL UP OR DOWN?
TECHNOLOGIES-POWERED WEB AND THE POST-BROWSER ERA
PROTECTED CONTENT: END-TO-END PGP ENCRYPTION FOR DRUPAL
DRUPAL AUDITS MADE FASTR
FROM DISTRO TO CUSTOM - HOW WE CREATE GREAT COMMUNITIES FOR EVERY ORGANIZATIO...
SEARCH API: TIPS AND TRICKS - FROM BEGINNING TO CUSTOM SOLUTIONS
DEVOPS & THE DEATH AND REBIRTH OF CHILDHOOD INNOCENCE

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Cell Structure & Organelles in detailed.
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Institutional Correction lecture only . . .
PDF
Pre independence Education in Inndia.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Insiders guide to clinical Medicine.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Pharma ospi slides which help in ospi learning
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
STATICS OF THE RIGID BODIES Hibbelers.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Cell Structure & Organelles in detailed.
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Institutional Correction lecture only . . .
Pre independence Education in Inndia.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
VCE English Exam - Section C Student Revision Booklet
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Insiders guide to clinical Medicine.pdf
Complications of Minimal Access Surgery at WLH
human mycosis Human fungal infections are called human mycosis..pptx
Supply Chain Operations Speaking Notes -ICLT Program
102 student loan defaulters named and shamed – Is someone you know on the list?
Pharma ospi slides which help in ospi learning
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...

DRUPAL AND ELASTICSEARCH

  • 2. Flexible and powerful open source, distributed real-time search and analytics engine for the cloud Elasticsearch
  • 3. Flexible and powerful open source, distributed real-time search and analytics engine for the cloud Elasticsearch RESTful API on top of Lucene library
  • 5. Why use Elasticsearch? ● RESTful API 
 ● Open Source 
 ● JSON over HTTP 
 ● based on Lucene 
 ● distributed 
 ● highly available 
 ● schema free 
 ● massively scalable 

  • 8. How to use it? > curl -XGET localhost:9200/?pretty
  • 9. How to use it? > curl -XGET localhost:9200/?pretty {
 "ok" : true, "status" : 200, "name" : "Infinity", "version" : { "number" : "0.90.1", "snapshot_build" : false, "lucene_version" : "4.3" }, "tagline" : "You Know, for Search" }
  • 10. How to use it? > curl -XGET localhost:9200/?pretty action
  • 11. How to use it? > curl -XGET localhost:9200/?pretty node + port
  • 12. How to use it? > curl -XGET localhost:9200/?pretty path
  • 13. How to use it? > curl -XGET localhost:9200/?pretty query string
  • 15. Let's index some data > PUT /index/type/id Where? It's very similar to database in SQL
  • 16. Let's index some data > PUT /index/type/id What? Table
 Content type,
 Entity type,
 any kind of type you decide
  • 17. Let's index some data > PUT /index/type/id Which? Node ID, Entity ID,
 any kind of serial ID
  • 18. Let's index some data > PUT /mysite/node/1 {
 "nid": "1", "status": "1",
 "title": "Hello elasticsearch",
 "body": "First elasticsearch document" }
  • 19. Let's index some data > PUT /mysite/node/1 -d { "nid": "1", "status": "1",
 "title": "Hello elasticsearch",
 "body": "First elasticsearch document" } {
 "ok":true, "_index":"mysite", "_type":"node", "_id":"1", "_version":1 }
  • 21. Let's GET some data > GET /mysite/node/1 {
 "_index" : "mysite", "_type" : "node", "_id" : "1", "_version" : 1, "exists" : true, "_source" : { "nid":"1",
 "status":"1",
 "title":"Hello elasticsearch”, "body":"First elasticsearch document" } }
  • 22. Let's GET some data Get specific fields > GET /mysite/node/1?fields=title,body Get source only > GET /mysite/node/1/_source
  • 23. Let's UPDATE some data > PUT /mysite/node/1 { “status":"0" }
  • 24. Let's UPDATE some data > PUT /mysite/node/1 { "status":"0" } {
 "ok":true, "_index":"mysite", "_type":"node", "_id":"1", "_version":2 }
  • 26. Let's DELETE some data > DELETE /mysite/node/1
  • 27. Let's DELETE some data > DELETE /mysite/node/1 { "ok":true, "found":true, "_index":"mysite", "_type":"node", "_id":"1", “_version":3 }
  • 29. Let's SEARCH for something > GET /_search { "took" : 32, "timed_out" : false, "_shards" : { "total" : 20, "successful" : 20, "failed" : 0 }, "hits" : { results... } }
  • 30. Let's SEARCH in multiple indices and types
  • 31. Let's SEARCH in multiple indices and types > GET /index/_search > GET /index1,index2/_search > GET /index/type/_search 
 > GET /myapp_*/type, entity_*/_search
  • 33. Let's PAGINATE results > GET /_search?size=10&from=20 size = results per page from = starting from
  • 35. Let's search oldschool > GET /_search?q=title:elasticsearch > GET /_search?q=nid:60
  • 37. Query DSL style > GET /_search?size=10&from=20 { "query": {
 “match": "awesome" } }
  • 38. Query DSL style > GET /_search?size=10&from=20 {
 "query": { "field" : { "title" : { “query" : "+awesome -poor", "boost" : 2.0, } } } }
  • 40. Queries & Filters full text search exact match relevance score show or hide heavy lightning fast
 not cacheable cacheable
  • 42. Combine Filters & Queries {
 "query": { "filtered": { "query": { "match": { "title": "awesome" } }, "filter": {
 "term": { "type": "article" } } } } } > GET /_search
  • 44. Sorting {
 "query": { "filtered": { "query": { “match": { "title": "awesome" } }, "filter": {
 "term": { "type": "article" } } } } "sort": {"date":"desc"} } > GET /_search
  • 45. and Facets "aggregations" : { "<aggregation_name>" : { "<aggregation_type>" : { <aggregation_body> } [,"meta" : { [<meta_data_body>] } ]? [,"aggregations" : { [<sub_aggregation>]+ } ]? } [,"<aggregation_name_2>" : { ... } ]* }
  • 46. and Facets > GET /_search { "aggregations": { "home_team": { "terms": {
 "field": “field_home_team" } } } }
  • 47. and Facets > GET /_search { "aggregations": { "home_team": { "terms": {
 "field": “field_home_team" } } } } Give your facet a name
  • 48. and Facets > GET /_search { "aggregations": { "home_team": { "terms": {
 "field": “field_home_team" } } } } Your facet filter can be: ● Terms
 ● Range
 ● Histogram
 ● Date Histogram ● Filter
 ● Query
 ● Statistical
 ● Terms Stats
 ● Geo Distance
 ● Cardinality
 ● Nested
  • 49. and Facets "aggregations" : { "home_team" : { "_type" : "terms", "missing" : 203, "total" : 100, "other" : 42, "terms" : [ { "term" : "hou", "count" : 8 }, {
 "term" : "sln", "count" : 6 }, ...
  • 50. STOP! I want this in Drupal
  • 51. STOP! I want this in Drupal Available modules: Search API + elasticsearch_connector
  • 52. Let the Search be with you