Let you have a preliminary understanding of es

First of all, es has very good search capabilities in massive data. You can think of es as a search engine database. It is a non-relational database. His syntax is very different, it seems that they are all in json style. Another thing that needs to be said is that es data is stored on the hard disk.

Let's first take a look at the difference between mysql and es. Show a picture.

While carefully looking at the picture above, it would be better if you add the syntax of es yourself.

Hey, then I will take you to take a look at the basic syntax of es. You can have a preliminary understanding of the differences between mysql and es.

Let’s start with chatgpt’s answer explaining words starting with an underscore.

 

Basic syntax of es

1. Check the cluster status of es: GET _cluster/health?pretty Result:

 

2. Create index

PUT /teacher

result:

 

3. Create an index with a tokenizer: ( If you need to use a plug-in tokenizer, you need to specify it when building the index. Once the index is created, you cannot change the tokenizer

result

 

4. Set the number of shards:

 Let’s also talk about sharding here.

ES provides a sharding mechanism. The same index can be stored in different shards (data containers). This means that an index can be divided into multiple slices and then stored on different es nodes.

5. Delete index:

DELETE /teacher

result:

 

6. Set index mapping: mapping is divided into dynamic mapping (dynamic mapping), explicit mapping (static mapping), strict mapping (strict mapping)

a. Dynamic mapping. When setting mapping, there is no relevant field set. It is there when inserting. It can be found when querying _mapping.

b. Static mapping. When setting mapping, the relevant fields are not set. When inserting, they are not found when querying _mapping. The data will be stored.

c. Strict mapping, an error will be reported directly when inserting

 result

 

7. Insert data into es:

result: 

8. Update data: (updating does not modify the original data, but marks the original data as deleted and re-inserts a piece of data)

 

 result:

9. Delete a piece of data:

DELETE /user/_doc/3

result

 

 10. Get full data:

10. Get data based on conditions:

a.并:must(last_name='hong' and first_name='xiao')

b.或:should(last_name='hong' or first_name='xiao')

c.不等于:must_not(last_name!='hong' and first_name!='xiao')

e: Sort according to a certain field & only return the required fields

 

f: Difference between match, match_phrase, match_phrase_prefix and multi_match 

h:filter (condition filter query, the range of filter conditions is represented by range, gt means greater than, lt means less than, gte means greater than or equal to, lte means less than or equal to)

 

i: Compound queries need to use bool

j:keyword,text,match,term difference 

k: ES aggregation query avg, max, min, sum

 

 

 

How to segment words?

Whose integration is es?

Decomposed next time

おすすめ

転載: blog.csdn.net/qq_52988841/article/details/132483107