ElasticSearch Tutorial: Two ways to create an index

The index library of ES is a logical concept, which includes word segmentation list and document list, and the same type of documents are stored in the same index library. It is equivalent to MySQL中的表, or equivalent to Mongodb中的集合.

About the term index:
Index (noun): ES is a search service based on Lucene, which searches for qualified index data from the index library.
Index (verb): The index library is empty when it is created, and the process of adding data to the index library is called indexing.

The following introduces two methods of creating an index library. Their working principles are the same, and the client sends commands to the ES service.

1) Use tools like postman or curl to create

put http://localhost:9200/索引库名称

{
    
    
	"settings":{
    
    
		"index":{
    
    
			"number_of_shards":1,
			"number_of_replicas":0
		}
	}
}
  • number_of_shards: Set the number of shards. Usually, multiple shards are set in the cluster, indicating that an index library will be split into multiple shards to store different nodes, which improves the processing capability and high availability of ES. The entry program uses a stand-alone environment. Set to 1 here.
  • number_of_replicas: Set the number of replicas. The purpose of setting replicas is to improve the high reliability of ES. The stand-alone environment is set to 0.

The following is an example of creation, creating an xc_course index library with a total of 1 shard and 0 copies:
insert image description here

2) Created using the head plugin

insert image description here

Guess you like

Origin blog.csdn.net/a772304419/article/details/132383484