Professional Documents
Culture Documents
Pavan Navule
Contents
▪ Introduction
▪ Terminology
– Index, Type, Document, Field
– Comparison with Relational Database
▪ Architecture
– Clusters, Nodes, Shards & Replicas
▪ Search
– How it works?
– Inverted Index
▪ Elastic in Action
– Indexing, Querying & Deleting
Introduction
Distributed
Terminology
▪ Index
– Is means of storing different types of data.
▪ Type
– A type is a convenient way to store a specific type of data within an
index
▪ Document
– A document is JSON object (set of
‘key-value’ pairs aka fields)
▪ _type
▪ _id
▪ _source
Terminology
▪ Field
– Key
▪ type (data type)
▪ Format
– Value
▪ Can hold scalar data (int, string values)
or Nested structures like array or
object
Terminology (Comparison with RDBMS)
Id Status
1 Reserved
2 In House
3 Departed
Architecture
https://prezi.com/hmxfrorhtcq-/elasticsearch/
Search
Cluster
N
• Master Node
• Multicast to find other nodes
• Manage Cluster State N N
• Assign Shards to Nodes
N
Search
Cluster Replica
N
N N
N
Search
Internode Communication
Cluster
N
• Sends parallel Queries to all nodes
Inverted Index
• Tokenize
• Remove • Frequency • Identify &
duplicates List the
• Sort documents
Search
▪ Download from
www.elastic.co/downloads/elasticsearch
– Extract to your desired location
▪ Configuration
– Default port 9200
– Configure
▪ Config file location “~/elasticsearch-x.y.z/config/elasticsearch.yml“
▪ node name
▪ port
▪ path for log files etc.,
Run Elastic Server
▪ Go to “~/elasticsearch-2.4.0/bin/“
▪ Double click “elasticsearch.bat”
Indexing
Syntax Example
POST /{index}/{type}/{optional-id} POST /sampleindex/sampletype/
{ {
"key-n": "value", }
}
Querying
Syntax Example
Search
Search by property
DELETE /{Index}/{Type}/{Id}
Eg:
DELETE demo/reservation/1
Review
▪ Introduction
▪ Terminology
– Index, Type, Document, Field
– Comparison with Relational Database
▪ Architecture
– Clusters, Nodes, Shards & Replicas
▪ Search
– How it works?
– Inverted Index
▪ Elastic in Action
– Indexing, Querying & Deleting