Kibana Query Language (KQL)
This document summarizes Kibana Query Language (KQL).
1. Kibana Query Language (KQL)
1.1 Terms Query
A query that outputs only documents where the field and value exactly match.
[Field]:[Value]: Get only documents where value exists in fieldresponse:200: Get only documents where value200exists inresponsefieldmessage:ssup2: Get only documents where string valuessup2exists inmessagefieldmessage:"ssup2 blog": Get only documents where string valuessup2 blogexists inmessagefield
1.2. Boolean Query
A query using logical operators not, and, or. You can limit comparison targets and change priority using parentheses.
not [Field]:[Value]: Get only documents where value does not exist in fieldnot response:200: Get only documents where value200does not exist inresponsefield
[Field1]:[Value1] and [Field2]:[Value2]: Get only documents where value1 exists in field1 and value2 exists in field2response:200 and message:"ssup2": Get only documents where value200exists inresponsefield and string valuessup2exists inmessagefield
[Field]:([Value1] or [Value2]): Get only documents where value1 or value2 exists in fieldresponse:(200 or 404): Get only documents where value200exists or value404exists inresponsefield
1.3. Range Query
A query using comparison operators >, >=, <, <=.
[Field]:[Value]>[Number]: Get only documents where value less than number exists in field
1.4. Wildcard Query
A query using wildcard (*).
[Field]:*: Get only documents where field existsresponse:*: Get only documents whereresponsefield exists
[Field]:[Value]*: Get only documents where value starting withValuestring exists in fieldmessage:ssup*: Get only documents where value starting withssupstring exists inmessagefield
[Field]*:[Value]: Get only documents where value exists in field starting withFieldstringmess*:ssup2: Get only documents where string valuessup2exists in field starting withmessstring
1.5. Nested Field Query
A query for nested fields where a field exists inside a field.
[Field1]:{[Field2]:[Value]}: Get only documents where value exists in field2 inside field1request:{response:200}: Get only documents where value200exists inresponsefield insiderequestfield
2. References
- KQL (Kibana Query Language) : https://www.elastic.co/guide/en/kibana/master/kuery-query.html
- Kibana queries and filters : https://www.elastic.co/guide/en/beats/packetbeat/current/kibana-queries-filters.html