Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The basic introduction and usage of ES

Shulou Source: shulou.com Published: 2022-06-02 07:35:39 11月15日 Update

This article mainly explains "the basic introduction and use of ES", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the basic introduction and usage of ES.

Official document: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html

Documents that insert data in bulk: https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-bulk.html

Add, delete, change and check all follow the refult style

Use postman to create a new document

1 increase

Http://localhost:9200/blog1/article/1

{"id": 1, "title": "when creating an index in a flexible search,", "content": "Why? because there are write parameters in mappings that are not supported in the elasticsearch6 version, index_analyzer does not support it. Change it to analyzer. Just change it, and you can build the index successfully."}

2 query

Query GET: http://localhost:9200/blog1/article/1 according to id

Query POST: http://localhost:9200/blog1/article/_search based on keywords

{"query": {"term": {"content": "because"}

Use a string query (participle the query condition before querying) POST: http://localhost:9200/blog1/article/_search

{"query": {"query_string": {"default_field": "content", "query": "create index"}

# built-in word separator POST _ analyze {"analyzer": "standard", "text": "The 2 QUICK Brown-Foxex jumped over the lazy dog's bone."} POST _ analyze {"analyzer": "simple", "text": "The 2 QUICK Brown-Foxex jumped over the lazy dog's bone."} POST _ analyze {"analyzer": "whitespace" "text": "The 2 QUICK Brown-Foxex jumped over the lazy dog's bone."} POST _ analyze {"analyzer": "stop", "text": "The 2 QUICK Brown-Foxex jumped over the lazy dog's bone."} POST _ analyze {"analyzer": "keyword", "text": "The 2 QUICK Brown-Foxex jumped over the lazy dog's bone."} POST _ analyze {"analyzer": "pattern" "text": "The 2 QUICK Brown-Foxex jumped over the lazy dog's bone."}

# step # 1 to insert a piece of data into the es (to use _ doc in es7) PUT my_index_test/_doc/1 {"referrer": "-", "response_code": "200"," remote_ip ":" 192.168.1.1 "," method ":" post "," user_name ":" zhangsan "," http_version ":" 1.1 "," body_sent ": {" bytes ":" 0 "} "url": "/ query/list"} # 2 get the index mappingGET my_index_test/_mapping#3 you just created and delete the index mappingPUT my_index_test {"mappings": {"properties": {"body_sent": {"properties": {"bytes": {"type": "text" just obtained by the indexDELETE my_index_test#4 transformation. } "http_version": {"type": "keyword"}, "method": {"type": "keyword"}, "referrer": {"type": "keyword"}, "remote_ip": {"type": "ip"} "response_code": {"type": "keyword"}, "url": {"type": "text"}, "user_name": {"type": "text"} # 5 verify the data GET my_index_test/_doc/1 just inserted here I believe that you have a deeper understanding of the "basic introduction and use of ES". 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!

Tags: Queries methods usage data documents indexes content learning support practicality depth success keywords keywords interests parameters characters strings official practicality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Microsoft Huawei Shulou Technology Redmi