Es

ElasticSearch is known as the search middleware currently used by most companies. For ElasticSearch, use Es instead.

The installation

Homebrew is installed

If you already have Homebrew installed, you can skip this step and go straight to Elasticsearch.

Homebrew is a software package management tool based on MacOS platform. It has many practical functions, such as installation, uninstallation, update, view, search, etc. It is highly recommended to install.

Please copy the following command to the command line to paste execution:

The/usr/bin/ruby - e "$(curl - fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Copy the code

For details about common Homebrew commands, see common Homebrew commands

Es to install

Brew install ElasticsearchCopy the code

Displayed after the installation is successful

After the installation, run the Es service command to start the Es service

brew servicEs start elasticsearch 
Copy the code

Enter localhost:9200 in the browser to check whether Es is successfully started. The following is a screenshot

If the brew servicEs list is not displayed, check whether the service is started or run the JPS command to check whether the service is started

Use Brew Info ElasticSearch to view the current Es installation directory go to the directory to view the startup logs

Es plug-in Installation

Download ElasticSearch Head from the Google App Store using science

After login, click the plug-in to enter the initial page

The name of the cluster is ElasticSearch_coapeng. The current cluster status is green

Or you can use Postman to query cluster status

Es noun introduction

There are some agreed terms in Es that need to be introduced. Es is a distributed search analysis engine. Compared with the traditional RDS, its outstanding advantage lies in the rapid search by disassembly of stored content by analyzer and establishment of inverted index.

Although Es is a search analysis engine, it is still a storage system at the bottom. A concept can be quickly established by analogy with RDS.

Index :(noun) similar to a database

Document: Similar to a table in a database

Shard: Similar to horizontal shard, the data of a table is split and stored on multiple storage nodes

Master shard: node where data is stored

Secondary shard: a copy of the master shard, which becomes the master shard when the master shard node is down

Word splitter: The data in each column is divided into phrases according to certain rules

Forward index: Form of data stored in RDS

! [image-20210426220121555](/Users/coapeng/Library/Application Support/typora-user-images/image-20210426220121555.png)

Inverted index: specific column data is segmented with a word splitter, and the phrases segmented can be used as keywords to find the corresponding ID (id 1 in the previous figure).

! [image-20210427102637647](/Users/coapeng/Library/Application Support/typora-user-images/image-20210427102637647.png)

Word splitter: split each column of data according to certain rules es commonly used word splitter are

  • The standard word segmentation is divided into terms based on the Unicode text segmentation algorithm. It removes most punctuation marks, the term after a lower-case participle, in favor of stop words

  • Keyword: A keyword without an operation that outputs the same content as the input as a single term

  • Ik word segmentation plug-ins developed for Chinese have ik_MAX_word and IK_smart modes corresponding to fine granularity and coarse granularity respectively

    The ik word can be installed on Github as readme.md. The ik word can be installed on Github as readme.md

  • Whitespace splits a string when it encounters a space character

  • Stop: similar to a simple word splitter, and supports the removal of stop words (simply understood as unimportant words)

  • Simple: This toggle splits strings, lowercase all terms, when non-letters are encountered