Real-time search in Drupal.
Meet Elasticsearch
By Alexei Gorobets
asgorobets
Elasticsearch
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
RESTful API on top of Lucene library
Why use
Elasticsearch?
● RESTful API
● Open Source
● JSON over HTTP
● based on Lucene
● distributed
● highly available
● schema free
● massively scalable
STOP! Why not SOLR?
● Solr vs Elasticsearch: Features Smackdown
● Detailed overview
● Slideshare presentation by Sematext
● Realtime Search: Solr vs Elasticsearch
Apache Solr vs Elasticsearch
Real-time search in Drupal. Meet Elasticsearch
Setup in 2 steps:
1. Extract the archive
2. > bin/elasticsearch
How to use it?
> curl -XGET localhost:9200/?pretty
> 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"
}
> curl -XGET localhost:9200/?pretty
action
> curl -XGET localhost:9200/?pretty
node + port
> curl -XGET localhost:9200/?pretty
path
> curl -XGET localhost:9200/?pretty
query string
Let's index some data
> PUT /index/type/id
Where?
It's very similar to
database in SQL
> PUT /index/type/id
What?
Table
Content type,
Entity type,
any kind of type you decide
> PUT /index/type/id
Which?
Node ID,
Entity ID,
any kind of serial ID
> PUT /mysite/node/1 -d
{
"nid": "1",
"status": "1",
"title": "Hello elasticsearch",
"body": "First elasticsearch document"
}
> 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
> 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"
}
> GET /mysite/node/1?fields=title,body
Get specific fields
> GET /mysite/node/1?fields=title,body
Get specific fields
> GET /mysite/node/1/_source
Get source only
Let's UPDATE some data
> PUT /mysite/node/1 -d
{
"status":"0"
}
> PUT /mysite/node/1 -d
{
"ok":true,
"_index":"mysite",
"_type":"node",
"_id":"1",
"_version":2
}
{
"status":"0"
}
UPDATE = DELETE + PUT
Let's DELETE some data
> DELETE /mysite/node/1
> DELETE /mysite/node/1
{
"ok":true,
"found":true,
"_index":"mysite",
"_type":"node",
"_id":"1",
"_version":3
}
Let's SEARCH for something
> GET /_search
> GET /_search
{
"took" : 32,
"timed_out" : false,
"_shards" : {
"total" : 20,
"successful" : 20,
"failed" : 0
},
"hits" : { results... }
}
Let's SEARCH in multiple
indices and types
> GET /index/_search
> GET /index/type/_search
> GET /index1,index2/_search
> GET /myapp_*/type, entity_*/_search
Let's PAGINATE results
> GET /_search?size=10&from=20
size = results per page
from = starting from
Let's search oldschool
> GET /_search?q=title:elasticsearch
> GET /_search?q=nid:60
+title:awesome
+status:1
+created:>1369917354
?q=title:awesome%20%2Bcreated:
>1369917354%20%2Bstatus:1
+title:awesome
+status:1
+created:>1369917354
The ugly encoding =)
Query DSL style
> GET /_search -d
{
"query": {
"match": "awesome"
}
}
> GET /_search -d
{
"query": {
"field" : {
"title" : {
"query" : "+awesome -poor",
"boost" : 2.0,
}
}
}
}
Queries & Filters
Queries & Filters
full text search
relevance score
heavy
not cacheable
exact match
show or hide
lightning fast
cacheable
Combine Filters & Queries
> GET /_search -d
{
"query": {
"filtered": {
"query": {
"match": { "title": "awesome" }
},
"filter": {
"term": { "type": "article" }
}
}
}
}
and Sorting
> GET /_search -d
{
"query": {
"filtered": {
"query": {
"match": { "title": "awesome" }
},
"filter": {
"term": { "type": "article" }
}
}
}
"sort": {"date":"desc"}
}
and Facets
Facets on Amazon
> GET /_search -d
{
"facets": {
"home_team": {
"terms": {
"field": "field_home_team"
}
}
}
}
> GET /_search -d
{
"facets": {
"home_team": {
"terms": {
"field": "field_home_team"
}
}
}
}
Give your facet a name
> GET /_search -d
{
"facets": {
"home_team": {
"terms": {
"field": "field_home_team"
}
}
}
}
Your facet filter can be:
● Terms
● Range
● Histogram
● Date Histogram
● Filter
● Query
● Statistical
● Terms Stats
● Geo Distance
"facets" : {
"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?
Available modules:
elasticsearch
Search API elasticsearch
Development directions:
1. Search API implementation
2. Field Storage API
Available modules:
elasticsearch
Search API elasticsearch
Field Storage API implementation
Elasticsearch field storage sandbox by Damien Tournoud
Started in July 2011
Field Storage API implementation
Elasticsearch field storage sandbox by Damien Tournoud
Started in July 2011
Elasticsearch EntityFieldQuery sandbox
Commited today! =)
Let's DEMO
Elasticsearch sandbox here:
https://drupal.org/sandbox/asgorobets/2073151
Let the Search be with you
Real-time search in Drupal. Meet Elasticsearch

More Related Content

PDF
Real-time search in Drupal with Elasticsearch @Moldcamp
PPTX
Drupal 8 + Elasticsearch + Docker
PPT
Drupal and Elasticsearch
PDF
elk_stack_alexander_szalonnas
PDF
Machine Learning in a Twitter ETL using ELK
PPTX
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
PPTX
Elk stack
PDF
From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity ...
Real-time search in Drupal with Elasticsearch @Moldcamp
Drupal 8 + Elasticsearch + Docker
Drupal and Elasticsearch
elk_stack_alexander_szalonnas
Machine Learning in a Twitter ETL using ELK
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
Elk stack
From Zero to Production Hero: Log Analysis with Elasticsearch (from Velocity ...

What's hot (20)

PDF
Monitoramento com ELK - Elasticsearch - Logstash - Kibana
PPTX
PDF
ELK introduction
PDF
ELK, a real case study
PDF
Why should I care about REST?
PDF
kRouter
PDF
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
PDF
Go database/sql
PDF
Application Logging With The ELK Stack
PDF
Elk devops
PDF
Real-time data analysis using ELK
PDF
Scaling SolrCloud to a Large Number of Collections - Fifth Elephant 2014
PDF
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
PPTX
Scrapy-101
PDF
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
PDF
2nd Athens Big Data Meetup - 2nd Talk - ElasticSearch: Index and Search Log F...
PDF
Google App Engine With Java And Groovy
PPT
Mongo Web Apps: OSCON 2011
PDF
MySQL in Go - Golang NE July 2015
PDF
Selenium&scrapy
Monitoramento com ELK - Elasticsearch - Logstash - Kibana
ELK introduction
ELK, a real case study
Why should I care about REST?
kRouter
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
Go database/sql
Application Logging With The ELK Stack
Elk devops
Real-time data analysis using ELK
Scaling SolrCloud to a Large Number of Collections - Fifth Elephant 2014
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Scrapy-101
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
2nd Athens Big Data Meetup - 2nd Talk - ElasticSearch: Index and Search Log F...
Google App Engine With Java And Groovy
Mongo Web Apps: OSCON 2011
MySQL in Go - Golang NE July 2015
Selenium&scrapy
Ad

Viewers also liked (7)

PDF
Media management in Drupal @Moldcamp
PDF
Dependency injection in Drupal 8
PDF
Why drupal
PDF
Создание дистрибутивов Drupal. Почему, зачем и как?
PDF
Extending media presentation
PPTX
Migrate in Drupal 8
PDF
Meetup Drupal Paris : Connexion Drupal et Elasticsearch
Media management in Drupal @Moldcamp
Dependency injection in Drupal 8
Why drupal
Создание дистрибутивов Drupal. Почему, зачем и как?
Extending media presentation
Migrate in Drupal 8
Meetup Drupal Paris : Connexion Drupal et Elasticsearch
Ad

Similar to Real-time search in Drupal. Meet Elasticsearch (20)

PDF
DRUPAL AND ELASTICSEARCH
PDF
Enhancement of Searching and Analyzing the Document using Elastic Search
PDF
DrupalANDElasticsearch
PDF
Introduction to Elasticsearch
PPTX
Elastic search Walkthrough
PPTX
An Introduction to Elastic Search.
PPTX
Elastic pivorak
PDF
Faster and better search results with Elasticsearch
PPTX
Elasticsearch an overview
PDF
ElasticSearch - index server used as a document database
PDF
ElasticSearch Introduction
PPTX
ElasticSearch Basics
PDF
Mastering Elasticsearch 2nd Edition Edition Rafal Kuc
PDF
Elasticsearch and Spark
PPT
Elk presentation1#3
PDF
Elasticsearch Introduction at BigData meetup
PPTX
Elasticsearch - DevNexus 2015
PDF
Elasticsearch Quick Introduction
PPSX
Elasticsearch - basics and beyond
KEY
Intro to Apache Solr for Drupal
DRUPAL AND ELASTICSEARCH
Enhancement of Searching and Analyzing the Document using Elastic Search
DrupalANDElasticsearch
Introduction to Elasticsearch
Elastic search Walkthrough
An Introduction to Elastic Search.
Elastic pivorak
Faster and better search results with Elasticsearch
Elasticsearch an overview
ElasticSearch - index server used as a document database
ElasticSearch Introduction
ElasticSearch Basics
Mastering Elasticsearch 2nd Edition Edition Rafal Kuc
Elasticsearch and Spark
Elk presentation1#3
Elasticsearch Introduction at BigData meetup
Elasticsearch - DevNexus 2015
Elasticsearch Quick Introduction
Elasticsearch - basics and beyond
Intro to Apache Solr for Drupal

Recently uploaded (20)

PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
UiPath Agentic Automation session 1: RPA to Agents
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PPTX
Build Your First AI Agent with UiPath.pptx
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
The various Industrial Revolutions .pptx
PPTX
TEXTILE technology diploma scope and career opportunities
DOCX
search engine optimization ppt fir known well about this
PDF
Zenith AI: Advanced Artificial Intelligence
Flame analysis and combustion estimation using large language and vision assi...
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Getting started with AI Agents and Multi-Agent Systems
Credit Without Borders: AI and Financial Inclusion in Bangladesh
Basics of Cloud Computing - Cloud Ecosystem
A contest of sentiment analysis: k-nearest neighbor versus neural network
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
Final SEM Unit 1 for mit wpu at pune .pptx
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
UiPath Agentic Automation session 1: RPA to Agents
A review of recent deep learning applications in wood surface defect identifi...
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
Taming the Chaos: How to Turn Unstructured Data into Decisions
Build Your First AI Agent with UiPath.pptx
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
The various Industrial Revolutions .pptx
TEXTILE technology diploma scope and career opportunities
search engine optimization ppt fir known well about this
Zenith AI: Advanced Artificial Intelligence

Real-time search in Drupal. Meet Elasticsearch