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 is the introduction and guidelines for the use of ElasticSearch

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article gives you an introduction to ElasticSearch and what the guidelines are. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Introduction to ES

Elasticsearch is a distributed, Restful-style search data analysis engine, which can meet the storage and retrieval needs of conventional and various types of data. As the core of ELK and ElasticStack, it can store data centrally, and can perform and merge many types of searches (structured data, unstructured data, geographical location, latitude and longitude coordinates and other data structures) through Elasticsearch.

Characteristics and advantages of ES

Distributed real-time file storage, where each field can be indexed so that it can be retrieved

Real-time analysis of the distributed search engine, distributed, the index is divided into multiple fragments, the data nodes in the cluster can carry one or more fragments, and coordinate and handle various operations, load rebalancing and routing are done automatically in most cases.

It can expand to hundreds of servers to handle structured and unstructured data at the PB level, or it can run on a single PC.

Support plug-in mechanism, participle plug-in, synchronization plug-in, Hadoop plug-in, visual plug-in.

Some basic concepts of ES

Cluster: cluster. ES can be used as a separate single search server. However, in order to handle large datasets and achieve fault tolerance and high availability, ES can run on many cooperative servers where ES instances are clustered.

Node: node. The instance on each server that forms the cluster is divided into nodes.

Shard: sliced. When there are a large number of documents, due to memory limitations, insufficient disk processing capacity, unable to respond quickly enough to client requests, etc., one node may not be enough. In this case, the data can be divided into smaller shards, each shard on a different server, and when the index of the query is distributed across multiple shards, ES will send the query to the relevant shards and combine the results together. The application is not aware of the existence of sharding, that is, the process is transparent to the user.

Replica: copy. To improve query throughput or achieve high availability, you can use a sharded copy, which is an exact copy of a shard, and each shard can have 0 or more copies.

The corresponding relationship between ES and traditional database

Some corresponding Relations between ES and traditional Relational Database structure

Relational data

Elasticsearch remarks

Database DatabaseIndex

Table TableType

Multiple type is no longer supported above 6.x

Record Recorddocument

Table structure Scheme

Mapping

Column Column

Field

The data structure of ES ES stores a wide range of data field types, including core types, compound types and special types.

Second-level classification

Specific type

Core type string type

String, text, keyword

Integer type

Integer, long, short, byte

Floating point type

Double, float, half_float, scaled_float

Logical type

Boolean

Date type ‍‍ date

Range type range (integer_range, float_range, long_range, double_range, date_range) binary type binary

Compound type object type

Object

Nesting type

Nested

Geographical type geographical coordinate type

Geo-point

Geographic map ‍ Geo-shape

Special type IP type

Ip

Automatic completion of type ‍ completion

Statistical type

Token_count

Attachment Type attachement

Filter type percolator field type description: the string type is widely used in the old version. String is no longer supported from 5.x, but replaced by text and keyword. The text type indicates that when a field is to be searched full-text, such as Email content and product description, the text type should be used. After setting the text type, the field content will be analyzed and segmented, and the string will be divided into an entry by the parser before generating the inverted index. The Keyword type is suitable for indexed structured fields, and fields of type keyword can only be searched by precise values. Nested nested types are specialized versions of object data types that allow object data to be indexed in a way that can be queried independently of each other. It is designed to store JSON type data and can be queried through JSON internal fields. The geo_point type stores latitude and longitude values, and documents can be sorted and filtered by distance, while location distances can be calculated by querying ES.

Inverted index of ES

The index structure of traditional relational database (taking MySQL as an example) is the structure of search tree ("B+" tree). Its leaf nodes store index data fields, and other nodes search and index. The indexing process is to find the corresponding record directly through the binary search tree. It can be understood to find the corresponding record by one column (primary key index) or several columns (combined index).

Figure 1.MySQL "B+" Tree Index

However, the index of ES is very different. It stores the result of word segmentation as a data index after the document (document) is segmented by a certain word separator. The inverted index stores the mapping relationship between the result of document word segmentation and the document.

About the introduction of ElasticSearch and what is the guide to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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