ES basic grammar

1. Query index information

GET /blog5
  1. Query index mapping information
GET /blog5/_mapping
  1. Match query
GET /blog5/_search 
{
    
    
  "query": {
    
    
    "match": {
    
    
      "content": "你"
    }
  },
  "size": 20
}

4. Dictionary query

GET /blog5/_search 
{
    
    
  "query": {
    
    
    "term": {
    
    
      "content": {
    
    
        "value": "你"
      }
    }
  }
}

5.bool query

Key words description
must The result of the query must match the query conditions and calculate the score
filter The result of the query must match the query conditions, and the score will not be calculated if it is different from must
should The query result must meet one or more of the query conditions
must_not The query result must not meet the query conditions

6. The difference between match query and term query.

Key words description
match Segment query on the query field
term Precise query

7. aggs aggregate query (equivalent to group by)

GET /blog5/_search 
{
    
     "query": {
    
    
  "term": {
    
    
    "cid": {
    
    
      "value": "2"
    }
  }
}, 
  "aggs": {
    
    
    "classification": {
    
    
      "terms": {
    
    
        "field": "cid"
      }
    }
  }
}

Guess you like

Origin blog.csdn.net/weixin_44981707/article/details/108269922