Home » Key concepts of ES

Key concepts of Elasticsearch

Elasticsearch is a document-oriented NoSQL database, which is used to store data in the form of document. It allows the users to store, analyze, and search a large amount of data. Elasticsearch is one of the major products of ELK stack along with Logstash, Kibana, and Beats. But in this tutorial, we are only working with Elasticsearch. This tutorial will go with the flow of Elasticsearch.

Let us discuss the key concepts or important terms used in Elasticsearch, which are –

  1. Node
  2. Cluster
  3. Document
  4. Index
  5. Shard
  6. Replicas
  7. Type
  8. Mapping

These key concepts of Elasticsearch are discussed below in detail:

Node

Key concepts of Elasticsearch

A node is an instance of Elasticsearch, which is used to store data. It creates when an Elasticsearch instance starts running. In simple words, it refers to a running instance of Elasticsearch. A node is identified by its name for administration purposes.

Cluster

Key concepts of Elasticsearch

The cluster is a set of one or more nodes that works together to hold the data. Clusters provide search capabilities and joined indexing across all nodes for entire data. Basically, it is a group of systems that runs the Elasticsearch engine.

Similar to the node, it is also identified by a name for administration purposes. The default name of the cluster is elasticsearch.

Document

Key concepts of Elasticsearch

The document is a collection of fields in a unique way, as defined in JSON format. It is used to store the data that resides inside the Elasticsearch index. So, it can be indexed. Every document belongs to a type and associated with a unique identifier (UID). It is expressed in JSON (Key: Value) pair. In RDBMS, a document is represented as a row in a table.

In Elasticsearch terms, Document = Row, Field = Column, Index = Table, and Cluster = Database.

Index

Key concepts of Elasticsearch

Index is a group of different types of documents. It helps to perform search, update, and delete operation as well as indexing. In a relational database, an index is represented as a table, which means the index is analogous to a table in RDBMS.

Elasticsearch allows to define various indexes in a single cluster. To improve the performance, index uses the concept of shards.

Shard

Key concepts of Elasticsearch

A large amount of data can be stored using a cluster, but it can exceed the capability of a single server. To overcome this problem, Elasticsearch allows your index to be divided into several pieces, called shard. So, divide your index into several pieces to create shards. You can define the number of required shards while creating an index.

While creating an index, the number of required shards can be defined. Each shard is independent and fully functional.

Replicas

Key concepts of Elasticsearch

Replicas are an additional copy of shards. They perform queries just like a shard. Elasticsearch enables the users to create replicas of their indexes and shards.

Elasticsearch provides replicas to avoid any type of failure and helps to enhance the availability of data in case of failure. The failure can be like – a node or shard is going to offline for some reason. Replication not only increases the availability of data but also improve the performance of search by executing parallel search operation in these replicas.

Type

Key concepts of Elasticsearch

In Elasticsearch, a type is defined for documents that have a common set of fields. It is a logical category of index whose semantics depends on users.

Mapping

In Elasticsearch, each index has a mapping associated with it, which is a schema-definition of the data that can be held by each individual document in an index. Mapping can be automatically done or can also be created manually for the index. When the data is pushed to an index, the mapping is automatically added.

Comparison between ES and RDBMS

In Elasticsearch (ES), a document is similar to the row in RDBMS (Relational Database). The collection of rows creates a table, which is called index in Elasticsearch. Let us compare the terms used in Elasticsearch with RDBMS.

Elasticsearch RDBMS
Document Row
Field Column
Index Table
Cluster Database

You may also like