elastic / elastic/docs-content

Show the newest records first in generated ES|QL queries

Open
#7,952 1 comment 0 reactions 1 assignee Claimed by @florent-leborgne View on GitHub
Feature: ES|QL Team:SKI
Dominant language
No language data
Stars
47
Forks
261
Avg merge
3d 12h
Merged PRs (30d)
116

Description

## Summary

Kibana-generated starter ES|QL queries now append SORT <time field> DESC when the source data view defines a time field. The behavior applies when switching Discover from classic mode, opening new Discover searches or tabs, and generating initial queries from dashboard, Lens, and global-search entry points; existing WHERE conversions remain in the query.

**Why this needs docs:** The published Discover workflow explains automatic query and filter conversion but does not mention that generated queries now request newest records first.

## Resources

- PR [#255532](https://github.com/elastic/kibana/pull/255532) — [ES|QL] Sort by timestamp by default

## Availability

| Channel | Details |
|---------|---------|
| **Stack** | v9.6.0 |
| **Serverless** | Aug 17–Aug 21 |
| **Feature flag** | None — active by default |

---
*Created with [Docs Quest Scanner](https://github.com/florent-leborgne/docs-quest-scanner) by @florent-leborgne*

## Suggested edits

[Using ES|QL](https://www.elastic.co/docs/explore-analyze/discover/try-esql) > Get started with ES|QL in Discover
- **What the docs say:** The page explains that switching from classic mode converts an existing KQL or Lucene query and supported filters into ES|QL, but it does not describe the generated sort clause.
- **What to add:** Add that when the source data view has a time field, Kibana adds SORT <time field> DESC to the generated starter query so the newest records appear first; note that this uses the configured time field and coexists with converted WHERE conditions. Applies from 9.6.0 and in serverless.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.