ElasticSearch's universal search statement query_string

When we use kibana to query, how do we organize effective sentences to quickly and accurately locate relevant content?

In the most common log query, I want to find out all logs that contain Exception. If you directly query in the search box kibana you might check out some of the content is not what you want
, for example, may be in addition to a true exception may also be that you do not know what the log frame to break out of exception=nullsomething
so this time We can use query_string to filter when querying

GET _search
{
    
    
  "query":{
    
    
    "query_string": {
    
    
      "default_field": "message",
      "query": "*Exception AND -*exception=null"
    }
  }
}

default_field: This parameter specifies a field, if it is used, it fieldsis followed by an array of fields.
query: The innermost layer indicates that the content to be queried contains *Exceptionand does not contain *exception=null.

query_string: Supports wildcards *, AND, OR, it must contain +not contain-

Guess you like

Origin blog.csdn.net/a807719447/article/details/107563198