SlideShare a Scribd company logo
1
Shaunak Kashyap
Developer at Elastic
@shaunak
Elasticsearch for SQL users
The Elastic Stack
2
Store, Index & Analyze
Ingest
User Interface
Plugins
Hosted Service
3
Agenda
Search queries
Data modeling
Architecture
1
2
3
2
4
Agenda
Search queries
Data modeling
Architecture
1
3
5
Agenda
Search queries
Data modeling
1
2
3 Architecture
6
Search Queries
https://www.flickr.com/photos/samhames/4422128094
7
CREATE TABLE IF NOT EXISTS emails (
sender VARCHAR(255) NOT NULL,
recipients TEXT,
cc TEXT,
bcc TEXT,
subject VARCHAR(1024),
body MEDIUMTEXT,
datetime DATETIME
);
CREATE INDEX emails_sender ON emails(sender);
CREATE FULLTEXT INDEX emails_subject ON emails(subject);
CREATE FULLTEXT INDEX emails_body ON emails(body);
curl -XPUT 'http://localhost:9200/enron' -d'
{
"mappings": {
"email": {
"properties": {
"sender": { "type": "keyword" },
"recipients": { "type": "keyword" },
"cc": { "type": "keyword" },
"bcc": { "type": "keyword" },
"subject": { "type": "text", "analyzer": "english" },
"datetime": { "type": "date" }
}
}
}
Schemas
8
Loading the data
9
[LIVE DEMO]
• Search for text in a single field
• Search for text in multiple fields
• Search for a phrase
https://github.com/ycombinator/es-enron
10
Other Search Features
Stemming Synonyms Did you mean?
• Jump, jumped, jumping • Queen, monarch • Monetery => Monetary
11
Data Modeling
https://www.flickr.com/photos/samhames/4422128094https://www.flickr.com/photos/ericparker/7854157310
12
To analyze (text) or not to analyze (keyword)?
PUT cities/city/1
{
"city": "Raleigh",
"population": 431746
}
PUT cities/city/2
{
"city": "New Albany",
"population": 8829
}
PUT cities/city/3
{
"city": "New York",
"population": 8406000
}
POST cities/_search
{
"query": {
"match": {
"city": "New Albany"
}
}
}
QUERY
+ = ?
PUT cities/city/1
{
"city": "Raleigh",
"population": 431746
}
13
To analyze (text) or not to analyze (keyword)?
PUT cities/city/2
{
"city": "New Albany",
"population": 8829
}
PUT cities/city/3
{
"city": "New York",
"population": 8406000
}
Term Document IDs
albany 2
new 2,3
raleigh 1
york 3
14
To analyze (text) or not to analyze (keyword)?
PUT cities
{
"mappings": {
"city": {
"properties": {
"city": {
"type": "keyword"
}
}
}
}
}
MAPPING
Term Document IDs
New Albany 2
New York 3
Raleigh 1
PUT blog/post/1
{
"author_id": 1,
"title": "...",
"body": "..."
}
PUT blog/post/2
{
"author_id": 1,
"title": "...",
"body": "..."
}
PUT blog/post/3
{
"author_id": 1,
"title": "...",
"body": "..."
}
15
Relationships: Application-side joins
PUT blog/author/1
{
"name": "John Doe",
"bio": "..."
}
POST blog/author/_search
{
"query": {
"match": {
"name": "John"
}
}
}
QUERY 1
POST blog/post/_search
{
"query": {
"match": {
"author_id": <each id from query 1 result>
}
}
}
QUERY 2
PUT blog/post/1
{
"author_name": "John Doe",
"title": "...",
"body": "..."
}
PUT blog/post/2
{
"author_name": "John Doe",
"title": "...",
"body": "..."
}
16
Relationships: Data denormalization
POST blog/post/_search
{
"query": {
"match": {
"author_name": "John"
}
}
}
QUERY
PUT blog/post/3
{
"author_name": "John Doe",
"title": "...",
"body": "..."
}
17
Relationships: Nested objects
PUT blog/author/1
{
"name": "John Doe",
"bio": "...",
"blog_posts": [
{
"title": "...",
"body": "..."
},
{
"title": "...",
"body": "..."
},
{
"title": "...",
"body": "..."
}
]
}
POST blog/author/_search
{
"query": {
"match": {
"name": "John"
}
}
}
QUERY
18
Relationships: Parent-child documents
PUT blog/author/1
{
"name": "John Doe",
"bio": "..."
}
POST blog/post/_search
{
"query": {
"has_parent": {
"type": "author",
"query": {
"match": {
"name": "John"
}
}
}
QUERY
PUT blog
{
"mappings": {
"author": {},
"post": {
"_parent": {
"type": "author"
}
}
}
} PUT blog/post/1?parent=1
{
"title": "...",
"body": "..."
}
PUT blog/post/2?parent=1
{
"title": "...",
"body": "..."
}
PUT blog/post/3?parent=1
{
"title": "...",
"body": "..."
}
19
Architecture
https://www.flickr.com/photos/samhames/4422128094
https://www.flickr.com/photos/haribote/4871284379/
20
RDBMS Triggers
database by Creative Stall from the Noun Project
1 2
21
Async replication to Elasticsearch
1
2 3
ESSynchronizer
flow by Yamini Ahluwalia from the Noun Project
22
Async replication to Elasticsearch with Logstash
1
2 3
23
Forked writes from application
1
2
24
Forked writes from application (more robust)
1
2
queue by Huu Nguyen from the Noun Project
ESSynchronizer3
4
25
Forked writes from application (more robust with Logstash)
1
2
3
4
26
Questions?
@shaunak
https://www.flickr.com/photos/nicknormal/2245559230/

More Related Content

What's hot (20)

PDF
Node.js and Parse
Nicholas McClay
 
PDF
Meetup Performance
Greg Whalin
 
PPTX
The Past Year in Spring for Apache Geode
VMware Tanzu
 
PDF
Leveraging Open Source for Database Development: Database Version Control wit...
All Things Open
 
PDF
the Spring 4 update
Joshua Long
 
PDF
Play framework
Andrew Skiba
 
PDF
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
mfrancis
 
ZIP
Barcamp Auckland Rails3 presentation
Sociable
 
PPTX
Play + scala + reactive mongo
Max Kremer
 
PDF
COScheduler
WO Community
 
PPTX
Gruntwork Executive Summary
Yevgeniy Brikman
 
PDF
Dcm#8 elastic search
Ivan Wallarm
 
PDF
Even faster django
Gage Tseng
 
PDF
Finatra v2
Steve Cosenza
 
PPT
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
Srijan Technologies
 
PDF
Asynchronous web apps with the Play Framework 2.0
Oscar Renalias
 
PPTX
Microservices/dropwizard
FKM Naimul Huda, PMP
 
PDF
Django REST Framework
Load Impact
 
PDF
Play vs Rails
Daniel Cukier
 
PDF
DOSUG Taking Apache Camel For A Ride
Matthew McCullough
 
Node.js and Parse
Nicholas McClay
 
Meetup Performance
Greg Whalin
 
The Past Year in Spring for Apache Geode
VMware Tanzu
 
Leveraging Open Source for Database Development: Database Version Control wit...
All Things Open
 
the Spring 4 update
Joshua Long
 
Play framework
Andrew Skiba
 
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
mfrancis
 
Barcamp Auckland Rails3 presentation
Sociable
 
Play + scala + reactive mongo
Max Kremer
 
COScheduler
WO Community
 
Gruntwork Executive Summary
Yevgeniy Brikman
 
Dcm#8 elastic search
Ivan Wallarm
 
Even faster django
Gage Tseng
 
Finatra v2
Steve Cosenza
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
Srijan Technologies
 
Asynchronous web apps with the Play Framework 2.0
Oscar Renalias
 
Microservices/dropwizard
FKM Naimul Huda, PMP
 
Django REST Framework
Load Impact
 
Play vs Rails
Daniel Cukier
 
DOSUG Taking Apache Camel For A Ride
Matthew McCullough
 

Similar to Elasticsearch for SQL Users (20)

PDF
Elasticsearch for SQL Users
Great Wide Open
 
PPTX
Elasticsearch
Yervand Aghababyan
 
PPTX
Elasticsearch a real-time distributed search and analytics engine
gautam kumar
 
PDF
Elasto Mania
andrefsantos
 
PDF
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
Piotr Pelczar
 
PDF
ElasticSearch
Volodymyr Kraietskyi
 
PDF
06. ElasticSearch : Mapping and Analysis
OpenThink Labs
 
PDF
Which Questions We Should Have
Oracle Korea
 
ODP
Elastic Search
NexThoughts Technologies
 
PPTX
Elasticsearch
Ricardo Peres
 
PDF
Elasticsearch for Data Analytics
Felipe
 
PPTX
An Introduction to Elastic Search.
Jurriaan Persyn
 
PPTX
Elastic 101 - API Logs
Ismaeel Enjreny
 
PPSX
Elasticsearch - basics and beyond
Ernesto Reig
 
PPTX
Open Source Search: An Analysis
Justin Finkelstein
 
PPTX
Search engine. Elasticsearch
Selecto
 
PPTX
Elasticsearch as a search alternative to a relational database
Kristijan Duvnjak
 
PDF
JavaCro'15 - Elasticsearch as a search alternative to a relational database -...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PDF
Introduction to Elasticsearch
Luiz Messias
 
PPTX
Presentation: mongo db & elasticsearch & membase
Ardak Shalkarbayuli
 
Elasticsearch for SQL Users
Great Wide Open
 
Elasticsearch
Yervand Aghababyan
 
Elasticsearch a real-time distributed search and analytics engine
gautam kumar
 
Elasto Mania
andrefsantos
 
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
Piotr Pelczar
 
ElasticSearch
Volodymyr Kraietskyi
 
06. ElasticSearch : Mapping and Analysis
OpenThink Labs
 
Which Questions We Should Have
Oracle Korea
 
Elastic Search
NexThoughts Technologies
 
Elasticsearch
Ricardo Peres
 
Elasticsearch for Data Analytics
Felipe
 
An Introduction to Elastic Search.
Jurriaan Persyn
 
Elastic 101 - API Logs
Ismaeel Enjreny
 
Elasticsearch - basics and beyond
Ernesto Reig
 
Open Source Search: An Analysis
Justin Finkelstein
 
Search engine. Elasticsearch
Selecto
 
Elasticsearch as a search alternative to a relational database
Kristijan Duvnjak
 
JavaCro'15 - Elasticsearch as a search alternative to a relational database -...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Introduction to Elasticsearch
Luiz Messias
 
Presentation: mongo db & elasticsearch & membase
Ardak Shalkarbayuli
 
Ad

More from All Things Open (20)

PDF
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
PPTX
Big Data on a Small Budget: Scalable Data Visualization for the Rest of Us - ...
All Things Open
 
PDF
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
PDF
Let's Create a GitHub Copilot Extension! - Nick Taylor, Pomerium
All Things Open
 
PDF
Leveraging Pre-Trained Transformer Models for Protein Function Prediction - T...
All Things Open
 
PDF
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
All Things Open
 
PDF
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
All Things Open
 
PPTX
DON’T PANIC: AI IS COMING – The Hitchhiker’s Guide to AI - Mark Hinkle, Perip...
All Things Open
 
PDF
Fine-Tuning Large Language Models with Declarative ML Orchestration - Shivay ...
All Things Open
 
PDF
Leveraging Knowledge Graphs for RAG: A Smarter Approach to Contextual AI Appl...
All Things Open
 
PPTX
Artificial Intelligence Needs Community Intelligence - Sriram Raghavan, IBM R...
All Things Open
 
PDF
Don't just talk to AI, do more with AI: how to improve productivity with AI a...
All Things Open
 
PPTX
Open-Source GenAI vs. Enterprise GenAI: Navigating the Future of AI Innovatio...
All Things Open
 
PDF
The Death of the Browser - Rachel-Lee Nabors, AgentQL
All Things Open
 
PDF
Making Operating System updates fast, easy, and safe
All Things Open
 
PDF
Reshaping the landscape of belonging to transform community
All Things Open
 
PDF
The Unseen, Underappreciated Security Work Your Maintainers May (or may not) ...
All Things Open
 
PDF
Integrating Diversity, Equity, and Inclusion into Product Design
All Things Open
 
PDF
The Open Source Ecosystem for eBPF in Kubernetes
All Things Open
 
PDF
Open Source Privacy-Preserving Metrics - Sarah Gran & Brandon Pitman
All Things Open
 
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
Big Data on a Small Budget: Scalable Data Visualization for the Rest of Us - ...
All Things Open
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Let's Create a GitHub Copilot Extension! - Nick Taylor, Pomerium
All Things Open
 
Leveraging Pre-Trained Transformer Models for Protein Function Prediction - T...
All Things Open
 
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
All Things Open
 
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
All Things Open
 
DON’T PANIC: AI IS COMING – The Hitchhiker’s Guide to AI - Mark Hinkle, Perip...
All Things Open
 
Fine-Tuning Large Language Models with Declarative ML Orchestration - Shivay ...
All Things Open
 
Leveraging Knowledge Graphs for RAG: A Smarter Approach to Contextual AI Appl...
All Things Open
 
Artificial Intelligence Needs Community Intelligence - Sriram Raghavan, IBM R...
All Things Open
 
Don't just talk to AI, do more with AI: how to improve productivity with AI a...
All Things Open
 
Open-Source GenAI vs. Enterprise GenAI: Navigating the Future of AI Innovatio...
All Things Open
 
The Death of the Browser - Rachel-Lee Nabors, AgentQL
All Things Open
 
Making Operating System updates fast, easy, and safe
All Things Open
 
Reshaping the landscape of belonging to transform community
All Things Open
 
The Unseen, Underappreciated Security Work Your Maintainers May (or may not) ...
All Things Open
 
Integrating Diversity, Equity, and Inclusion into Product Design
All Things Open
 
The Open Source Ecosystem for eBPF in Kubernetes
All Things Open
 
Open Source Privacy-Preserving Metrics - Sarah Gran & Brandon Pitman
All Things Open
 
Ad

Recently uploaded (20)

PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Digital Circuits, important subject in CS
contactparinay1
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 

Elasticsearch for SQL Users