This document discusses Elasticsearch and its uses for search. It describes how Elasticsearch can be used for intelligent search engines, autocomplete, geo-search, and search by colors. It then covers the basics of how Elasticsearch works, including its architecture with nodes, shards, and replicas. The document also outlines how to map and index documents, perform searches using queries and filters, and generate analytics through aggregations.
2. USE CASES
1. Intelligent search engines
…learning on users behaviour
„Search for cats
that I would love
from 3M database”
…forgiving spelling mistakes
„Search for Mihael Jakson photos
and show Michael Jackson photos”
6. OLD SCHOOL
Searching in MySQL
SELECT * FROM photos WHERE title LIKE ”%cat%”
SELECT * FROM photos WHERE title LIKE ”%cats%”
Id [PK] title
1 Cute cat and dog
2 Cat plays with a dog
3 Cats playing piano
… ….
3 000 000 Hidden cat
7. SEARCH THEORY
Building Inverted Index
Cute cat
and dog
#1
Cats
playing
piano
#3
Term [PK] Id
cute 1
cat 1, 2, 3
dog 1, 2
play 2, 3
… ….
Cat plays
with
a dog
#2
8. SEARCH THEORY
Text Analysis
Puppy and kitten with guinea pig
1. Tokenization
[Puppy] [and] [kitten] [with] [guinea] [pig]
2. Filtering tokens
[dog] [cat] [guinea] [pig]
Two separate
tokens? L
9. ASCII Folding – róża à roza
Lowercase - Cat à cat
Synonyms –
kitten à cat
puppy à dog
Stopwords – common words to remove
and, what, with, or
Stemming - reducing inflected words to their base
form
cats -> cat
fishing, fisher, fished -> fish
SEARCH THEORY
Text Analysis
21. Aggregations
Get likes stats and histogram of
created_at date grouped by
categories.
terms: category
- stats: likes
- histogram: created_at
ELASTICSEARCH
Analytics