Using Kibana Console
- To communicate with Elastic Serach we need to use REST API
- REST stands for Representational State Transfer. Its an architectural style that is used to make system inter operatate and interact with each other. REST has evolved over HTTP protocol.
- HTTP protocol supports different methods
- GET
- POST
- PUT
- DELETE
- HEAD
- Kibana Console gives us a Console UI which is part of developer tools which makes it easier to interact with Elastic Search
- So we will be using Kibana Dev Tools to understand Elastic Search

Core Concepts of Elastic Search
- The JSON documents in Elastic Search are organized as Elastic Search is a document-oriented store.
- Following are core concepts of Elastic search
- Indexes
- Types
- Documents
- Clusters
- Nodes
- Shards and replicas
- Mappings and Types
- Inverted Indexes
Index
- An index is a container that stores and manages documents of single type in Elastic Search

Type
- In practice, we should avoid mixing different entitites such as customers and products into single type, It makes sense to store them in seperate types with seperate Entities
Documents
- Documents contains multiple fields & each field in JSON document is of particular type
- In addition to the fields sent by user in the document, Elastic search maintains internal meta fields
_id: This is unique identifier of the document within a type_type: This field contains the type of the document_index: This field contains the index name of the document
Scenarios
- Create a new index and document

- Get the document created in the index

- Note: HTTP Status codes Refer Here
Nodes and Clusters
- Elastic search is a distributed system and it consits of multiple processes running on different machines that communicate
- Each machine which runs elastic search is a Node
- Every node is associated with unique id and name
- Node details can be configured in elasticsearch.yml
- A cluster is formed by one or more nodes. Every Elastic search node is always part of cluster.
- By default, every Elastic search node tries to join a cluster with the name Elasticsearch
- A cluster consists of multiple nodes, where each node takes the responsibility for storing, managing its share of data.
- One cluster can host one or more indexes.

Shards and replicas
- Lets try to understand what shard is, An index contains documents & Shards help in distributing an Index over cluster.
- Shards help in dividing the documents of single index over multiple nodes (Shards split data of single index over the cluster), hence allowing the storage, memory and processing capacities of cluster to be utilized
- The process of dividing data among shards is called sharding
- By default every index is configured to have five shards in Elastic Search
- While creating index we can specify number of shards

- Now lets assume Node 1 is down

- Distributed systems such as Elastic search are expected to run inspite of hardware failures. This issue is address by replica shards or replicas.
- Each shard in index is configured to have zero or more replica shards. Replica Shards are extra copies of the orginal shards and they created for high availability of data

- As you can observe in the image even if the Node 1 is down, then the data is getting served from other nodes with replicas ()
