Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basics of elasticsearch

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are the basics of elasticsearch". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the basics of elasticsearch"?

Define

Cluster: a cluster consisting of one or more nodes

Node: a single Elastic instance

Index: the index, the plural is Indices, is a collection of documents

Shard: sharding. Es is a distributed search engine. Indexes are usually divided into different parts, and the data distributed on different nodes is sharding.

Replica: copy. By default, ES creates 5 primary shards for each index, and creates one replica shard for each index.

Type: type. ES7 has been deprecated. There is only one default Type for an index, that is, _ doc.

Document: document, json type

Analogy with Mysql

Index corresponds to Database

Type corresponds to Table

Document corresponds to each record in the table

ES7.0 Type is abandoned.

Since the ES7.0 version, Type is discarded. An index has only one default type, namely _ doc.

After ES discarded Type, the library and table are integrated.

Analogy with Mysql

ES instance corresponds to Database

Index corresponds to Table

Document corresponds to each record in the table

Document uniqueness

Generally speaking, index + type + document _ id is globally unique in an instance or cluster, but it is actually index + type + shard identity + document _ id.

Data type

See the official document: https://www.elastic.co/guide/en/elasticsearch/reference/7.2/mapping-types.html

String type

Before ES5.0, the string was string

Since ES5.0, the string type has been abandoned and two types of keyword and text have been introduced.

Keyword does not support full-text search and can only use accurate matching with a maximum length of 32766 bytes (in utf8, the English alphabet is 1 byte, Chinese is 3 bytes, emoji match is 4 bytes)

Text supports full-text search with unlimited length

Array

Normal json array, []

When you hit one of the arrays when you make a query, you will think that the condition is met

Mapping and settings structure ES7 {"mappings": {"properties": {"name": {/ / attribute name "type": "keyword" / / attribute type}, "settings": {"index": {"number_of_shards": 1 / / number of fragments "number_of_replicas": 2 / / number of copies} ES6 {"mappings": {"student": {/ / Custom type "properties": {"name": {/ / attribute name "type": "keyword" / / attribute Type} "settings": {"index": {"number_of_shards": 1, / / number of fragments "number_of_replicas": 2 / / number of copies}} when the index is created Do I have to specify mapping and settings?

No, there are several behaviors:

Specify mapping when creating an index in ES7

Specify mapping and settings when creating an index in ES7

Create an index in ES7 first, and then specify mapping

Specify mapping and settings when creating an index in ES6

What is the purpose of setting the number of index copies and fragments?

The number of shards per node is kept between 20 and 25 per 1GB heap memory corresponding to the corresponding cluster.

The shard size of 50GB is usually defined as a limitation that applies to various use cases.

At this point, I believe you have a deeper understanding of "what are the basic knowledge of elasticsearch". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report