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

What is the elasticsearch syntax?

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

Share

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

This article mainly talks about "what is the grammar of elasticsearch". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the elasticsearch grammars?"

Grammar

/ / /

Command

Query all indexes GET / _ cat/indices

GET / _ cat/indices?v create index PUT / user delete index DELETE / user add document delete document query document GET / user/_searchname field contains "Zhang San" or "Li Si"

GET / user/_search

{

"query": {

"match": {"name": "Zhang San Li Si"}

}

"from": 0

"size": 20

"_ source": ["name"]

}

Match all documents GET / user/_search

{

"query": {

"match_all": {}

}

} all name fields, including GET / user/_search of "Zhang San"

{

"query": {

"match_phrase": {"name": "Zhang San"}

}

} bool query

Of all the data, the name field simultaneously

GET / user/_search including "Zhang San" and "Li Si"

{

"query": {

"bool": {

"must": [

{"match": {"name": "Zhang San"}}

{"match": {"name": "Li Si"}}

]

}

}

} bool query

Of all the data, the name field

GET / user/_search containing "Zhang San" or "Li Si"

{

"query": {

"bool": {

"should": [

{"match": {"name": "Zhang San"}}

{"match": {"name": "Li Si"}}

]

}

}

} bool query

Of all the data, the name field simultaneously

GET / user/_search that does not include "Zhang San" or "Li Si"

{

"query": {

"bool": {

"must_not": [

{"match": {"name": "Zhang San"}}

{"match": {"name": "Li Si"}}

]

}

}

} bool query

Of all the data, the name field

Includes "Zhang San" but does not include "Li Si" GET / user/_search

{

"query": {

"bool": {

"must": [

{"match": {"name": "Zhang San"}}

]

"must_not": [

{"match": {"name": "Li Si"}}

]

}

}

} filter query

Of all the data, 10

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