1. Discover #
Everyday search.
Getting started #
- Choose the data view and the time range (top right).
- Add columns from the field list; clicking a field shows its 5 most frequent values.
- Add filters in one click (+/-) from a document.
- Save the search to reuse it in a dashboard or share it.
2. KQL and Lucene #
Filtering documents.
KQL #
service.name : "checkout" and http.response.status_code >= 500
message : "timeout" and not host.name : web-0*
log.level : (error or critical)
user_agent.original : *bot*
http.request.method : POST and url.path : "/api/panier"| Need | KQL | Lucene |
|---|---|---|
| Equality | status : 500 | status:500 |
| Range | bytes >= 1000 | bytes:[1000 TO *] |
| Wildcard | host : web-* | host:web-* |
| Regular expression | No | host:/web-[0-9]+/ |
| Proximity, fuzzy | No | message:"erreur base"~3, timout~ |
Good practice: KQL is enough in 90% of cases and offers field autocompletion. Switch to Lucene only for regular expressions or fuzzy search.
3. ES|QL #
A step-by-step language.
Principle #
ES|QL (Elasticsearch Query Language) chains commands separated by |: you start from a source, filter, compute, aggregate, sort. It is available in Discover (ES|QL mode), in Lens and in alert rules.
FROM logs-*
| WHERE @timestamp > NOW() - 1 hour AND http.response.status_code >= 500
| STATS erreurs = COUNT(*) BY service.name
| SORT erreurs DESC
| LIMIT 10FROM logs-*
| EVAL duree_s = event.duration / 1000000000
| STATS p95 = PERCENTILE(duree_s, 95), requetes = COUNT(*) BY url.path
| WHERE requetes > 100
| SORT p95 DESCFROM logs-*
| GROK message "%{IP:client} %{WORD:methode} %{URIPATHPARAM:chemin} %{NUMBER:statut:int}"
| STATS total = COUNT(*) BY statut, BUCKET(@timestamp, 5 minutes)Good to know: ES|QL can parse fields on the fly (GROK,DISSECT), enrich (ENRICH,LOOKUP JOINdepending on the version) and bucket time (BUCKET): many analyses no longer require a visualization.
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Machine learning in Elastic: anomaly detection and AIOps
Automatically detect abnormal behaviour: anomaly detection jobs, datafeeds, detectors, influencer...
Kibana Maps and Canvas: geographic maps and presentations
Build maps with Kibana Maps (document, aggregation and choropleth layers, ES|QL) and dynamic pres...
Alerts, connectors and SLOs in Kibana
Create alert rules in Kibana (Elasticsearch query, ES|QL, custom threshold, logs), configure conn...
Kibana and Elastic Observability best practices
Checklist for running Kibana in production: versions, security, spaces and roles, versioned dashb...
Advanced Kibana: data views, Lens, dashboards, alerting and reporting
Use Kibana in depth: data views and runtime fields, Discover, Lens and formulas, dashboards and c...
Elastic Security: SIEM, detection rules and investigation
Use Elastic Security as a SIEM: ECS data sources, detection rule types (query, EQL, ES|QL, thresh...
Kibana: role, installation and first steps
What Kibana is in the Elastic suite, how to install it with Elasticsearch (start-local, Docker), ...
Visualizing in Kibana: Lens, dashboards and saved objects
Build visualizations with Lens, assemble interactive dashboards (filters, controls, links), and m...
Elastic path project: centralising and using logs
The validation project of the "Elastic Stack mastery" path: Elastic Agent and Fleet, Logstash, El...