SlideShare una empresa de Scribd logo
1 de 37
Descargar para leer sin conexión
#MDBlocal
Atlas Search Deep Dive
Will Chow
Senior Solutions Architect, MongoDB
TORONTO
#MDBLocal
{
“name”: “Will Chow”,
“MongoDB”: {
“positions”: [“Senior Solutions Architect”],
“since” : new Date (“2018-10”),
},
“Pre-MongoDB”: {
“positions”: [“Systems Engineer”, “Architect”, “Developer”],
“companies”: [ “Cloudera”, “IBM”, “DataMirror”]
},
“likes”: [“running”, “renovating” ]
}
About Me
#MDBLocal
AGENDA
Why Full
Text
Search?
Atlas
Search
Features
Queries +
How They
Work
Indexes and
Analyzers
Architecture
Why Full-Text Search?
Search is a requirement
for most applications
#MDBLocal
Why didn’t
[thing I want]
show up first?
#MDBLocal
Relevance is Complicated… Developer: “This result doesn’t
match the most terms.”
Marketing: “Why isn’t the promo on
top?”
Product: “If I type in an exact
product name, just skip the search.”
UX: “Users need categories
instead.”
CEO: “Change the top result right
NOW!”
Customer: “Je ne trouve pas ce que
je cherche …”
#MDBLocal
RelevanceisCritical
#MDBLocal
Searching with Text Search - $text
db.movies.find
({$text: {$search: "chikago"}},
{score: {$meta: "textScore"},
_id : 0,
title: 1,
fullplot: 1
}).sort
({score:{$meta:"textScore"}}).pretty()
[] (empty set)
#MDBLocal
Sync
#MDBLocal
Atlas Search Features
Native
Powered by
Performant
Text Indexes
Powerful
Query
Operators
Configurable
Language
Analyzers
Built-in
Highlighting
Flexible
Scoring
#MDBLocal
Atlas Search Features
Native
Powered by
Score is the Measure of Relevance Flexible
Scoring
#MDBLocal
So, build the best search
for your application
Atlas Search
Full Text Search Indexes
$searchBeta
#MDBLocal
How do I use it?
Create a cluster
on MongoDB
Atlas 4.2
(M30+)
Create a
database and
collection
Create a full
text index on
that collection
in Atlas
Query via
$searchBeta
aggregation
pipeline
#MDBLocal
Full Text Search Index
Creation
Dynamic Mapping
Static Mapping
#MDBLocal
Sample_mflix movies
document model
#MDBLocal
Searching with Full Text Search - $searchBeta
db.movies.aggregate([
{$searchBeta: { term: {
path: "title",
query: "chikago",
fuzzy: { "maxEdits": 1}},
highlight: { path: "fullplot"}}},
{$project: {
_id : 0,
title: 1,
score: { $meta: 'searchScore' },
highlights: { $meta: "searchHighlights"}}},
{$limit : 1}]).pretty()
{"title" : "Chicago",
"score" : 4.210028171539307,
highlights" : [{
path" : "fullplot",
"texts" : [
{"value" : "Murderess Velma Kelly finds herself on
death row in 1920s ",
"type" : "text"},
{"value" : "Chicago",
"type" : "hit"}],
"score" : 0.863726019859314}]}
#MDBLocal
db.movies.aggregate([
{ $match": {
"title": "The Godfather"
}},
{ $sort: { title: 1 } }
])
$searchBeta
db.movies.aggregate([
{ $searchBeta": {
"search": { query: "The Godfather",
path: "title",
score: { boost: {value: 3}}}}
])
Sort occurs after filter Sort occurs during filter
Query-time Scoring
DEMO
A Movie Search Engine using
Atlas Search
Will Chow
Architecture
How FTS works
#MDBLocal
MongoDB +
• Pre-existing functionality
• Highlights, Fuzzy-matching, Query-time scoring and
more
• Analyzers
• Language support
• Western languages: English, French, etc.
• Eastern Languages: CJK, Hindi, Thai, etc.
• Inverted index structure = fast searches
#MDBLocal
Inverted Index
{ _id: 1,
S: “The quick brown fox jumped over the lazy dog” }
{ _id: 2,
S: “Quick brown foxes leap over lazy dogs in summer” }
TERM DOC
The 1
Quick 2
brown 1, 2
fox 1
foxes 2
jumped 1
leap 2
TERM DOC
the 1
quick 1, 2
brown 1, 2
fox 1, 2
in 2
jump 1, 2
dog 1, 2
STEMMING,SYNONYMS
#MDBLocal
Real-world Inverted Index: A Concordance
#MDBLocal
Inverted Indices and Analyzers
“_id”: 3,
“title” : “Planes, Trains & Automobiles”
{
“planes” : [3, …],
“trains” : [3, …],
“automobiles” : [3, … ]
},
lucene.simple lucene.english
{
“plane” : [3, …],
“train” : [3, …],
“automobile” : [3, …],
}
lucene.keyword
{
“Planes, Trains &
Automobiles” : [3, …]
},
#MDBLocal
Querying and Analyzers
search: { query: “planes trains”,
path: “title” }
term(“plane”) OR
term(“train”)
term: { query: “planws”,
path: { value: “title”,
multi: ”simple”},
fuzzy: {maxEdits: 1 } }
Fuzzy(“planws”,
maxEdits: 1)
term: { query: “Planes(.*)”,
path: { value: “title”,
multi: ”keyword”},
regex: true} }
Regex(“Planes(.*)”)
lucene.keyword lucene.simple lucene.english
#MDBLocal
MongoDB Atlas FTS components
mongod mongos mongot (NEW!)
● $searchBeta aggregation
pipeline stage
● Talks mongodb wire
protocol to mongot
● Shard aware
implementation
● scatter-gather queries
● Based on Apache Lucene 8
● Integrated into MongoDB
Atlas
● Separate java process
from mongod
● collocated with mongod
#MDBLocal
FTS Indexing: Initial Sync
MongoDB Atlas
Query
Index Definition
Automation Agent
mongotmongod
Collection Scan
Complete!
#MDBLocal
FTS Indexing: Steady State
Documents
mongotmongod
changestream
MongoDB Atlas
(per node)
mongot watches
the changestream
continuously and
updates the
search index
#MDBLocal
Query Lifecycle
Wire Protocol
(over internet to
MongoDB Atlas) aggregate([ {$searchBeta: {
search: {
path: “name”,
query: “star wars”
}
}}]
mongod
Wire protocol
(localhost)
Lucene booleanQuery:
(should
(term(“name”, “star”),
term(“name”, wars”))
search: {
path: “name”,
query: “star wars”
}
[ { _id: “123”,score:
1.23,highlights: […] },
{…}]
{ “name” :
{ “star” : [123,124],
“wars” : [123,125,…]
}
}
Lookup([{_id: “123”],
{…}])
mongot
db.col.aggregate([
{$searchBeta: {
search: {
path: “name”,
query: “star wars”
}
}}])
app
[ { _id: “123”, title:
“Star Wars”}, {…}]
MongoDB Atlas Host
#MDBLocal
Sharding
• Merge
• Sort by score
mongos
request
result
per shard
per shard
• Scatter/gather
(each shard)
mongot,
mongod
mongot,
mongod
Primary Secondaries
Query
What’s next?
Feature Roadmap
#MDBLocal
• Expanded data type support
• Nums, dates, geo
• Synonyms
• Improved operators/syntax
• Architecture/performance
improvements
2019 Roadmap
#MDBLocal
Feedback
Visit cloud.mongodb.com
Please provide feedback using
the link on the FTS page.
We are listening!
DEMO
http://bit.ly/AtlasSearch_Movies
Key Takeaways
Ø Apache Lucene 8
Ø Uses MongoDB Query Language
Ø Wide variety of query operators – fuzzy, wildcard
Ø Flexible Scoring and Highlights
Ø Configurable Indexes
Ø Saves you time!!!
THANK YOU
#MDBlocal
Every session you rate enters you into a
drawing for a gift card!
https://www.surveymonkey.com/r/C8TFLRC
MongoDB Atlas Full-Text
Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive

Más contenido relacionado

La actualidad más candente

Introducing MongoDB Atlas
Introducing MongoDB AtlasIntroducing MongoDB Atlas
Introducing MongoDB Atlas
MongoDB
 

La actualidad más candente (20)

MongoDB Atlas
MongoDB AtlasMongoDB Atlas
MongoDB Atlas
 
Dense Retrieval with Apache Solr Neural Search.pdf
Dense Retrieval with Apache Solr Neural Search.pdfDense Retrieval with Apache Solr Neural Search.pdf
Dense Retrieval with Apache Solr Neural Search.pdf
 
Introducing MongoDB Atlas
Introducing MongoDB AtlasIntroducing MongoDB Atlas
Introducing MongoDB Atlas
 
Fast querying indexing for performance (4)
Fast querying   indexing for performance (4)Fast querying   indexing for performance (4)
Fast querying indexing for performance (4)
 
What is in a Lucene index?
What is in a Lucene index?What is in a Lucene index?
What is in a Lucene index?
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
 
Slash n near real time indexing
Slash n   near real time indexingSlash n   near real time indexing
Slash n near real time indexing
 
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective IndexingMongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
 
Apache Druid 101
Apache Druid 101Apache Druid 101
Apache Druid 101
 
Elasticsearch vs MongoDB comparison
Elasticsearch vs MongoDB comparisonElasticsearch vs MongoDB comparison
Elasticsearch vs MongoDB comparison
 
MongoDB World 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB World 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB World 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB World 2019: Tips and Tricks++ for Querying and Indexing MongoDB
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDB
 
JSON-LD for RESTful services
JSON-LD for RESTful servicesJSON-LD for RESTful services
JSON-LD for RESTful services
 
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's Scale
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's ScalePinot: Enabling Real-time Analytics Applications @ LinkedIn's Scale
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's Scale
 
Introducing MongoDB Atlas
Introducing MongoDB AtlasIntroducing MongoDB Atlas
Introducing MongoDB Atlas
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
 
SPARQL Cheat Sheet
SPARQL Cheat SheetSPARQL Cheat Sheet
SPARQL Cheat Sheet
 
Introduction to elasticsearch
Introduction to elasticsearchIntroduction to elasticsearch
Introduction to elasticsearch
 
Model Your Application Domain, Not Your JSON Structures
Model Your Application Domain, Not Your JSON StructuresModel Your Application Domain, Not Your JSON Structures
Model Your Application Domain, Not Your JSON Structures
 
MongoDB World 2019: The Sights (and Smells) of a Bad Query
MongoDB World 2019: The Sights (and Smells) of a Bad QueryMongoDB World 2019: The Sights (and Smells) of a Bad Query
MongoDB World 2019: The Sights (and Smells) of a Bad Query
 

Similar a MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive

Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Db
chriskite
 
MongoDB and Ruby on Rails
MongoDB and Ruby on RailsMongoDB and Ruby on Rails
MongoDB and Ruby on Rails
rfischer20
 

Similar a MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive (20)

MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...
MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...
MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
 
MongoDB .local Chicago 2019: Practical Data Modeling for MongoDB: Tutorial
MongoDB .local Chicago 2019: Practical Data Modeling for MongoDB: TutorialMongoDB .local Chicago 2019: Practical Data Modeling for MongoDB: Tutorial
MongoDB .local Chicago 2019: Practical Data Modeling for MongoDB: Tutorial
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comStreaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.com
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
MongoDB .local Chicago 2019: Still Haven't Found What You Are Looking For? Us...
MongoDB .local Chicago 2019: Still Haven't Found What You Are Looking For? Us...MongoDB .local Chicago 2019: Still Haven't Found What You Are Looking For? Us...
MongoDB .local Chicago 2019: Still Haven't Found What You Are Looking For? Us...
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Db
 
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
 
MongoDB and Ruby on Rails
MongoDB and Ruby on RailsMongoDB and Ruby on Rails
MongoDB and Ruby on Rails
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup
 
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012
 
MongoDB Introduction talk at Dr Dobbs Conference, MongoDB Evenings at Bangalo...
MongoDB Introduction talk at Dr Dobbs Conference, MongoDB Evenings at Bangalo...MongoDB Introduction talk at Dr Dobbs Conference, MongoDB Evenings at Bangalo...
MongoDB Introduction talk at Dr Dobbs Conference, MongoDB Evenings at Bangalo...
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo db
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRails
 
Back to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDBBack to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB.pdf
MongoDB.pdfMongoDB.pdf
MongoDB.pdf
 

Más de MongoDB

Más de MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDBMongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive

  • 1. #MDBlocal Atlas Search Deep Dive Will Chow Senior Solutions Architect, MongoDB TORONTO
  • 2. #MDBLocal { “name”: “Will Chow”, “MongoDB”: { “positions”: [“Senior Solutions Architect”], “since” : new Date (“2018-10”), }, “Pre-MongoDB”: { “positions”: [“Systems Engineer”, “Architect”, “Developer”], “companies”: [ “Cloudera”, “IBM”, “DataMirror”] }, “likes”: [“running”, “renovating” ] } About Me
  • 4. Why Full-Text Search? Search is a requirement for most applications
  • 5. #MDBLocal Why didn’t [thing I want] show up first?
  • 6. #MDBLocal Relevance is Complicated… Developer: “This result doesn’t match the most terms.” Marketing: “Why isn’t the promo on top?” Product: “If I type in an exact product name, just skip the search.” UX: “Users need categories instead.” CEO: “Change the top result right NOW!” Customer: “Je ne trouve pas ce que je cherche …”
  • 8. #MDBLocal Searching with Text Search - $text db.movies.find ({$text: {$search: "chikago"}}, {score: {$meta: "textScore"}, _id : 0, title: 1, fullplot: 1 }).sort ({score:{$meta:"textScore"}}).pretty() [] (empty set)
  • 10. #MDBLocal Atlas Search Features Native Powered by Performant Text Indexes Powerful Query Operators Configurable Language Analyzers Built-in Highlighting Flexible Scoring
  • 11. #MDBLocal Atlas Search Features Native Powered by Score is the Measure of Relevance Flexible Scoring
  • 12. #MDBLocal So, build the best search for your application Atlas Search Full Text Search Indexes $searchBeta
  • 13. #MDBLocal How do I use it? Create a cluster on MongoDB Atlas 4.2 (M30+) Create a database and collection Create a full text index on that collection in Atlas Query via $searchBeta aggregation pipeline
  • 14. #MDBLocal Full Text Search Index Creation Dynamic Mapping Static Mapping
  • 16. #MDBLocal Searching with Full Text Search - $searchBeta db.movies.aggregate([ {$searchBeta: { term: { path: "title", query: "chikago", fuzzy: { "maxEdits": 1}}, highlight: { path: "fullplot"}}}, {$project: { _id : 0, title: 1, score: { $meta: 'searchScore' }, highlights: { $meta: "searchHighlights"}}}, {$limit : 1}]).pretty() {"title" : "Chicago", "score" : 4.210028171539307, highlights" : [{ path" : "fullplot", "texts" : [ {"value" : "Murderess Velma Kelly finds herself on death row in 1920s ", "type" : "text"}, {"value" : "Chicago", "type" : "hit"}], "score" : 0.863726019859314}]}
  • 17. #MDBLocal db.movies.aggregate([ { $match": { "title": "The Godfather" }}, { $sort: { title: 1 } } ]) $searchBeta db.movies.aggregate([ { $searchBeta": { "search": { query: "The Godfather", path: "title", score: { boost: {value: 3}}}} ]) Sort occurs after filter Sort occurs during filter Query-time Scoring
  • 18. DEMO A Movie Search Engine using Atlas Search Will Chow
  • 20. #MDBLocal MongoDB + • Pre-existing functionality • Highlights, Fuzzy-matching, Query-time scoring and more • Analyzers • Language support • Western languages: English, French, etc. • Eastern Languages: CJK, Hindi, Thai, etc. • Inverted index structure = fast searches
  • 21. #MDBLocal Inverted Index { _id: 1, S: “The quick brown fox jumped over the lazy dog” } { _id: 2, S: “Quick brown foxes leap over lazy dogs in summer” } TERM DOC The 1 Quick 2 brown 1, 2 fox 1 foxes 2 jumped 1 leap 2 TERM DOC the 1 quick 1, 2 brown 1, 2 fox 1, 2 in 2 jump 1, 2 dog 1, 2 STEMMING,SYNONYMS
  • 23. #MDBLocal Inverted Indices and Analyzers “_id”: 3, “title” : “Planes, Trains & Automobiles” { “planes” : [3, …], “trains” : [3, …], “automobiles” : [3, … ] }, lucene.simple lucene.english { “plane” : [3, …], “train” : [3, …], “automobile” : [3, …], } lucene.keyword { “Planes, Trains & Automobiles” : [3, …] },
  • 24. #MDBLocal Querying and Analyzers search: { query: “planes trains”, path: “title” } term(“plane”) OR term(“train”) term: { query: “planws”, path: { value: “title”, multi: ”simple”}, fuzzy: {maxEdits: 1 } } Fuzzy(“planws”, maxEdits: 1) term: { query: “Planes(.*)”, path: { value: “title”, multi: ”keyword”}, regex: true} } Regex(“Planes(.*)”) lucene.keyword lucene.simple lucene.english
  • 25. #MDBLocal MongoDB Atlas FTS components mongod mongos mongot (NEW!) ● $searchBeta aggregation pipeline stage ● Talks mongodb wire protocol to mongot ● Shard aware implementation ● scatter-gather queries ● Based on Apache Lucene 8 ● Integrated into MongoDB Atlas ● Separate java process from mongod ● collocated with mongod
  • 26. #MDBLocal FTS Indexing: Initial Sync MongoDB Atlas Query Index Definition Automation Agent mongotmongod Collection Scan Complete!
  • 27. #MDBLocal FTS Indexing: Steady State Documents mongotmongod changestream MongoDB Atlas (per node) mongot watches the changestream continuously and updates the search index
  • 28. #MDBLocal Query Lifecycle Wire Protocol (over internet to MongoDB Atlas) aggregate([ {$searchBeta: { search: { path: “name”, query: “star wars” } }}] mongod Wire protocol (localhost) Lucene booleanQuery: (should (term(“name”, “star”), term(“name”, wars”)) search: { path: “name”, query: “star wars” } [ { _id: “123”,score: 1.23,highlights: […] }, {…}] { “name” : { “star” : [123,124], “wars” : [123,125,…] } } Lookup([{_id: “123”], {…}]) mongot db.col.aggregate([ {$searchBeta: { search: { path: “name”, query: “star wars” } }}]) app [ { _id: “123”, title: “Star Wars”}, {…}] MongoDB Atlas Host
  • 29. #MDBLocal Sharding • Merge • Sort by score mongos request result per shard per shard • Scatter/gather (each shard) mongot, mongod mongot, mongod Primary Secondaries Query
  • 31. #MDBLocal • Expanded data type support • Nums, dates, geo • Synonyms • Improved operators/syntax • Architecture/performance improvements 2019 Roadmap
  • 32. #MDBLocal Feedback Visit cloud.mongodb.com Please provide feedback using the link on the FTS page. We are listening!
  • 34. Key Takeaways Ø Apache Lucene 8 Ø Uses MongoDB Query Language Ø Wide variety of query operators – fuzzy, wildcard Ø Flexible Scoring and Highlights Ø Configurable Indexes Ø Saves you time!!!
  • 36. #MDBlocal Every session you rate enters you into a drawing for a gift card! https://www.surveymonkey.com/r/C8TFLRC MongoDB Atlas Full-Text Search Deep Dive