For Elastic Security and Kibana
Elastic KQL and ES|QL cheat sheet
Elastic has two query languages. Kibana KQL filters events in the search bar. ES|QL is a full piped language that can also count, group and reshape. Both are on this page, with the field names you need.
Checked against Elastic’s documentation in November 2026.
Kibana KQL
For the search bar in Discover and Elastic Security. It only filters. Set the time range with the time picker.
| To do this | Write this |
|---|---|
| Match a valueOn keyword fields, case and punctuation must match exactly. | |
| Any of several values | |
| Both conditions | |
| Exclude a value | |
WildcardOnly * is supported. Inside quotes it’s a plain asterisk. | |
| Field has a value | |
| Range | |
| Group conditions | |
ES|QL
For Discover in ES|QL mode, Elastic Security and detection rules. Each line after FROM starts with a pipe.
| To do this | Write this |
|---|---|
| Start from an index | |
| Last 24 hours | |
| Exact match | |
| Ignore case | |
| One of several | |
Wildcard match* is any text and ? is one character. Case-sensitive. | |
| Regex match | |
| Has a value | |
| Keep only these columns | |
| Drop a column | |
| Rename a column | |
| Add a calculated column | |
| Count by a column | |
| Count distinct valuesAn estimate. It can be slightly off on large data. | |
| Count per hour | |
| First and last seen | |
| Sort | |
Limit the rowsWith no LIMIT you get 1,000 rows. The most is 10,000. | |
| Split text with a pattern | |
| Pull text out with grok | |
| One row per value | |
Common field names
Elastic Security uses the Elastic Common Schema (ECS). These names are the same in Kibana KQL and ES|QL.
| To do this | Write this |
|---|---|
| Process name | |
| Command line | |
| Parent process | |
| Path to the program | |
| Computer name | |
| User name | |
| Windows event ID | |
| Source and destination IP | |
| Destination port | |
| File path | |
Watch out for
- Kibana KQL is not Microsoft’s KQL. They share a name and nothing else.
- Kibana KQL only filters. To count or group, switch to ES|QL.
- Keyword values are case-sensitive, and the Kibana search bar can’t ignore case. In ES|QL, use
TO_LOWER(). - In ES|QL, comparing a field that holds several values, like
==or>, gives null, so the row is dropped. UseMV_EXPANDfirst. - ES|QL returns 1,000 rows unless you add
LIMIT, and never more than 10,000. - A leading wildcard like
*shell.exeworks by default, but an admin can turn it off.
Official docs and cheat sheets
Elastic doesn’t publish an official cheat sheet for either language. These are its official references.
- Kibana Query Language (KQL)Elastic’s full reference for KQL in the search bar.(opens in a new tab)
- ES|QL referenceStart here for ES|QL commands, functions and limits.(opens in a new tab)
- ES|QL commandsEvery ES|QL command, from FROM to MV_EXPAND.(opens in a new tab)
- ES|QL functions and operatorsFunctions like TO_LOWER and BUCKET, and operators like LIKE.(opens in a new tab)
- ES|QL for securityElastic’s guides to hunting and detection rules with ES|QL.(opens in a new tab)
- ECS field referenceEvery Elastic Common Schema field and what it holds.(opens in a new tab)
Keep going
- Practise and learn Elastic KQL and ES|QLTicket-style exercises on realistic lab data.
- Kibana KQL vs ES|QLFiltering vs querying in Elastic, side by side.
- All cheat sheetsEvery language on one page.
- KQL cheat sheetFor Microsoft Defender and Microsoft Sentinel
- Sophos SQL cheat sheetFor Sophos Central Live Discover and Data Lake
Practise these in real exercises
A cheat sheet tells you the syntax. SOC Fluent gives you exercises to solve with it, on realistic lab data, and shows you what your query missed. Join the waitlist and we’ll email you once, on launch day.
Free to join. Students get 50% off at launch.