In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you the example analysis of elasticsearch kibana query, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1. Simple CRUD operation
1. Add
PUT / index/type/id {"json data"}
2. Query
GET / index/type/id
3. Modification
POST / index/type/id/_update {"doc": {"FIELD": "value"}}
4. Delete
DELETE / index/type/id
Second, search
Search can be divided into six categories
1 、 query string search
2 、 query DSL
3 、 query filter
4 、 full-text search
5 、 phrase search
6 、 highlight search
1 、 query string search
Search all: GET supplier/user/_search
{"took": 2, "timed_out": false, "_ shards": {"total": 5, "successful": 5, "failed": 0}, "hits": {"total": 3, "max_score": 1, "hits": [{"_ index": "supplier", "_ type": "user", "_ id": "2", "_ score": 1 "_ source": {"name": "lisi", "age": 26, "address": "bei jing tong zhou", "price": 10000, "dept": ["kaifabu"]}}, {"_ index": "supplier", "_ type": "user", "_ id": "1", "_ score": 1 "_ source": {"name": "zhangsan", "age": 30, "address": "bei jing chang chun jie", "price": 15000, "dept": ["kaifabu", "yanfabu"]}}, {"_ index": "supplier", "_ type": "user", "_ id": "3" "_ score": 1, "_ source": {"name": "wangwu", "age": 26, "address": "bei jing tong zhou yun he ming zhu", "price": 13000, "dept": ["kaifabu"]}
Took: it took a few milliseconds
Timed_out: whether or not to time out, there is no such thing.
_ shards: the data is split into 5 shards, so for search requests, all primary shard will be hit (or one of its replica shard will also work)
Hits.total: number of query results, 3 document
The meaning of hits.max_score:score is the matching score of document for the relevance of a search. The more relevant it is, the more matching it is, and the higher the score.
Hits.hits: contains detailed data of the document that matches the search
2 、 query DSL
Query all
GET supplier/user/_search {"query": {"match_all": {}
Query all and sort
GET suppluer/user/_search {"query": {"match_all": {}}, "sort": [{"price": {"order": "desc"}]}
Paging query
GET supplier/user/_search {"query": {"match_all": {}}, "from": 1, "size": 1}
Specify the field to query the display
GET supplier/user/_search {"query": {"match_all": {}}, "_ source": ["name", "price"]}
3 、 query filter
Search for those whose name is' lisi' and whose price is greater than 1500
GET supplier/user/_search {"query": {"must": {"match": {"name": "lisi"}}, "filter": {"range": {"price": {"gt": 1500}
4. Full-text search (full-text search)
The address field will be disassembled first to create an inverted index.
GET / ecommerce/product/_search {"query": {"match": {"address": "bei jing"}
5. Phrase search (phrase search)
Corresponding to full-text retrieval, full-text retrieval will disassemble the input search string and match it one by one in the inverted index. As long as it can match any of the disassembled words, it can be returned as a result.
Phrase search, which requires that the search string entered must be exactly the same in the specified field text before it can be considered a match and returned as a result.
GET / ecommerce/product/_search {"query": {"match_phrase": {"address": "bei jing"}
6. Highlight search (highlight search results)
GET / ecommerce/product/_search {"query": {"match": {"address": "bei jing"}}, "highlight": {"fields": {"address": {} these are all the contents of the article "sample Analysis of elasticsearch kibana query". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.