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

The basic introduction and usage of ES

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

Share

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

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!

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