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

PPTX
Full stack development with node and NoSQL - All Things Open - October 2017
PDF
Multi Client Development with Spring for SpringOne 2GX 2013 with Roy Clarkson
PDF
React Development with the MERN Stack
PDF
Composable and streamable Play apps
PDF
I can't believe it's not a queue: Kafka and Spring
PDF
Introduction to rest.li
PDF
Full Stack Scala
PPTX
Dropwizard Internals
Full stack development with node and NoSQL - All Things Open - October 2017
Multi Client Development with Spring for SpringOne 2GX 2013 with Roy Clarkson
React Development with the MERN Stack
Composable and streamable Play apps
I can't believe it's not a queue: Kafka and Spring
Introduction to rest.li
Full Stack Scala
Dropwizard Internals

What's hot (20)

PDF
Node.js and Parse
PDF
Meetup Performance
PPTX
The Past Year in Spring for Apache Geode
PDF
Leveraging Open Source for Database Development: Database Version Control wit...
PDF
the Spring 4 update
PDF
Play framework
PDF
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
ZIP
Barcamp Auckland Rails3 presentation
PPTX
Play + scala + reactive mongo
PDF
COScheduler
PPTX
Gruntwork Executive Summary
PDF
Dcm#8 elastic search
PDF
Even faster django
PDF
Finatra v2
PPT
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
PDF
Asynchronous web apps with the Play Framework 2.0
PPTX
Microservices/dropwizard
PDF
Django REST Framework
PDF
Play vs Rails
PDF
DOSUG Taking Apache Camel For A Ride
Node.js and Parse
Meetup Performance
The Past Year in Spring for Apache Geode
Leveraging Open Source for Database Development: Database Version Control wit...
the Spring 4 update
Play framework
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
Barcamp Auckland Rails3 presentation
Play + scala + reactive mongo
COScheduler
Gruntwork Executive Summary
Dcm#8 elastic search
Even faster django
Finatra v2
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
Asynchronous web apps with the Play Framework 2.0
Microservices/dropwizard
Django REST Framework
Play vs Rails
DOSUG Taking Apache Camel For A Ride
Ad

Similar to Elasticsearch for SQL Users (20)

PDF
Elasticsearch for SQL Users
PPTX
Elasticsearch a real-time distributed search and analytics engine
PPTX
Elasticsearch
PDF
GraphQL - gdy API RESTowe to za mało
PDF
[DevCrowd] GraphQL - gdy API RESTowe to za mało
PPTX
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
PDF
BruJUG Brussels GraphQL when RESR API is to less - lessons learned
PDF
d3sparql.js demo at SWAT4LS 2014 in Berlin
PDF
Liferay Search: Best Practices to Dramatically Improve Relevance - Liferay Sy...
PPTX
Elastic search and Symfony3 - A practical approach
PDF
Polyglot Persistence
PDF
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
PDF
GraphQL - when REST API is not enough - lessons learned
PDF
GraphQL - when REST API is to less - lessons learned
KEY
Elasticsearch & "PeopleSearch"
PDF
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
PPTX
ElasticSearch for .NET Developers
PDF
GraphQL - when REST API is to less - lessons learned
PDF
GraphQL - when REST API is to less - lessons learned
PDF
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
Elasticsearch for SQL Users
Elasticsearch a real-time distributed search and analytics engine
Elasticsearch
GraphQL - gdy API RESTowe to za mało
[DevCrowd] GraphQL - gdy API RESTowe to za mało
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
BruJUG Brussels GraphQL when RESR API is to less - lessons learned
d3sparql.js demo at SWAT4LS 2014 in Berlin
Liferay Search: Best Practices to Dramatically Improve Relevance - Liferay Sy...
Elastic search and Symfony3 - A practical approach
Polyglot Persistence
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is to less - lessons learned
Elasticsearch & "PeopleSearch"
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
ElasticSearch for .NET Developers
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
Ad

More from All Things Open (20)

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

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Electronic commerce courselecture one. Pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
A Presentation on Artificial Intelligence
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Spectroscopy.pptx food analysis technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Machine Learning_overview_presentation.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Network Security Unit 5.pdf for BCA BBA.
Electronic commerce courselecture one. Pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectral efficient network and resource selection model in 5G networks
A Presentation on Artificial Intelligence
Agricultural_Statistics_at_a_Glance_2022_0.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Empathic Computing: Creating Shared Understanding
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
A comparative analysis of optical character recognition models for extracting...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Dropbox Q2 2025 Financial Results & Investor Presentation
Machine Learning_overview_presentation.pptx
MYSQL Presentation for SQL database connectivity
Mobile App Security Testing_ A Comprehensive Guide.pdf

Elasticsearch for SQL Users