What is the relationship between clusters (Cluster), nodes (node), shards (Shard), Indices (indexes), replicas (backups) in Elasticsearch?

Source: Internet
Author: User

Recently in the know to see this problem, oneself also engaged half semester of Elasticsearch, so want to use oneself know shallow knowledge to answer this question.

Cluster contains multiple node,indices that should not be understood as a verb index , indices can be understood as databases,indices in a relational database can contain multiple indexes, The index corresponds to the database in relational databases, which is used to store related documents.
The analogy correspondence between Elasticsearch and relational data is as follows:

Relational Db⇒databases⇒tables⇒rows⇒columns

elasticsearch⇒indices⇒types⇒documents⇒ Fields

The document here can be understood as a JSON sequence object. Each document can contain more than one field.

Again, Shard, each index (corresponding database) contains multiple Shard, the default is 5, scattered on different node, but there will not be two identical shard exist on a node, so there is no meaning of backup. The Shard is a minimal Lucene index unit.

When a document is coming, Elasticsearch determines which shard it is placed on by hashing the docid, and then stores the index on the Shard.

Replicas is a backup,Elasticsearch uses the Push replication mode , when you index a document above the Master Master Shard, The Shard copies the document To all the remaining replica replica shards, these shards will also index this document. I personally think this model is very nice, sometimes the index of a document may produce a large index file, will be very much bandwidth, and only transfer the original file is much better.



When the query is, if the query is provided docid,elasticsearch through the hash to know which Doc exists shard above, and then through the routing table query will know which node above, let go to node above to fetch it. If DocId is not provided, Elasticsearch performs a search alert on all node (indics) shards, and then returns the search results, which are returned to the user after coordinating node gather.

Configuration needs to grasp what kind of principle, should go to see an ES optimization information, recommended two book

ElasticSearch Server (watercress), mastering ElasticSearch (watercress)

What is the relationship between clusters (Cluster), nodes (node), shards (Shard), Indices (indexes), replicas (backups) in Elasticsearch?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.