Skip to content

Document ES|QL timezone handling in Kibana#5455

Open
florent-leborgne wants to merge 12 commits intomainfrom
docs/esql-set-unmapped-fields
Open

Document ES|QL timezone handling in Kibana#5455
florent-leborgne wants to merge 12 commits intomainfrom
docs/esql-set-unmapped-fields

Conversation

@florent-leborgne
Copy link
Contributor

@florent-leborgne florent-leborgne commented Mar 11, 2026

Summary

Adds a Timezone handling section to the ES|QL in Kibana page, under the existing "Filter by time" section.

This is Kibana-specific content not covered in the ES|QL reference: it explains how Kibana controls the timezone used in ES|QL queries, and how to override it per-query using SET time_zone.

What it covers:

  • By default, Kibana applies the Time zone (dateFormat:tz) advanced setting to all ES|QL queries in Discover, dashboards, alerting, and Maps.
  • Per-query override: users can add SET time_zone = "..." before the source command to override the advanced setting for that specific query. This must be typed manually — it is not surfaced in autocomplete by design.

Verified against the Kibana codebase:

  • dateFormat:tz is passed to ES|QL queries via data/common/search/expressions/esql.ts (line 185)
  • SET time_zone is intentionally excluded from autocomplete in kbn-esql-language/scripts/generate_settings.ts

Manually tested using DATE_FORMAT("yyyy-MM-dd HH:mm z", @timestamp) to confirm the timezone applied:

  • Discover: returns the timezone from the dateFormat:tz advanced setting ✅
  • Data Visualizer: same behavior as Discover ✅
  • Dev Tools (no time_zone param): returns Z (UTC) ✅
  • Discover & Data Visualizer with SET time_zone = "America/New_York": returns EST/EDT, overriding the advanced setting ✅

Closes #4962

Supersedes #5456 (timezone content consolidated into this PR).

Related Kibana PR:

Generative AI disclosure

  1. Did you use a generative AI (GenAI) tool to assist in creating this contribution?
  • Yes
  • No
  1. If you answered "Yes" to the previous question, please specify the tool(s) and model(s) used (e.g., Google Gemini, OpenAI ChatGPT-4, etc.).

Tool(s) and model(s) used: claude-4.6-sonnet-medium in Cursor

Add a new section about the SET query directive to the ES|QL in
Kibana page, covering the unmapped_fields setting with its FAIL
and NULLIFY values. References the ES|QL SET directive reference
page for full syntax details.

Made-with: Cursor
@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

✅ Vale Linting Results

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide.

To use Vale locally or report issues, refer to Elastic style guide for Vale.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

🔍 Preview links for changed docs

Document the approximation setting with its boolean and map
parameter forms, including num_rows and confidence_level
parameters with suggested values.

Made-with: Cursor
@florent-leborgne florent-leborgne changed the title Document ES|QL SET directive and unmapped_fields setting Document ES|QL SET directive: unmapped_fields and approximation settings Mar 11, 2026
Move the SET directive content from a nested H3 under "Write
queries" to a standalone H2 section titled "Control query behavior
with SET", placed between "Filter by time" and "Use variables and
controls". This better reflects the conceptual parity with other
top-level sections that control query behavior.

Made-with: Cursor
The SET directive is in preview per the ES|QL reference docs
and the unmapped_fields setting has preview: true in the Kibana
codebase.

Made-with: Cursor
Document the actual server-side defaults from the Elasticsearch
codebase: 100K rows without grouping, 1M with grouping, rows
minimum of 10000, confidence_level range 0.5-0.95. Also corrects
the suggested confidence_level values (max is 0.95, not 0.99
as suggested in Kibana autocomplete).

Made-with: Cursor
Cross-references the timezone handling section under Filter by time
for the full explanation of how Kibana handles timezones.

Made-with: Cursor
Consolidates the timezone documentation into this PR since both
PRs modify the same page and cross-reference each other. The
timezone section is placed at the end of "Filter by time" and
covers both the Kibana advanced setting and SET time_zone override.

Made-with: Cursor
@leemthompo
Copy link
Contributor

leemthompo commented Mar 13, 2026

Related PR: #5402

ℹ️ that PR will be closed and recreated in elasticsearch, so link targets would change

Both settings are only available in snapshot builds and not supported
in serverless environments.

Made-with: Cursor
@florent-leborgne florent-leborgne changed the title Document ES|QL SET directive: unmapped_fields and approximation settings Document ES|QL SET directive: unmapped_fields, approximation, time_zone settings Mar 13, 2026
- Remove approximation section: not part of SET directive (confirmed)
- Fix unmapped_fields serverless tag: preview, not unavailable
- Remove redundant Control query timezone subsection inside SET
  (content already covered in the Timezone handling section above)

Made-with: Cursor
@florent-leborgne florent-leborgne changed the title Document ES|QL SET directive: unmapped_fields, approximation, time_zone settings Document ES|QL SET directive: unmapped_fields and time_zone settings in Kibana Mar 13, 2026
The SET directive reference content (unmapped_fields table, examples)
duplicates the ES|QL reference page without adding Kibana-specific value.
The timezone handling section is the only genuinely Kibana-specific
content: it documents the dateFormat:tz advanced setting behavior and
the per-query SET time_zone override.

Made-with: Cursor
@florent-leborgne florent-leborgne changed the title Document ES|QL SET directive: unmapped_fields and time_zone settings in Kibana Document ES|QL timezone handling in Kibana Mar 13, 2026
@florent-leborgne florent-leborgne marked this pull request as ready for review March 13, 2026 16:39
@florent-leborgne florent-leborgne requested review from a team as code owners March 13, 2026 16:39
@florent-leborgne
Copy link
Contributor Author

florent-leborgne commented Mar 13, 2026

@leemthompo I rescoped this page to just be about timezone handling since the rest wasn't kibana specific, making it useless to duplicate the ES|QL syntax docs. I'll treat CPS project routing separately

3. Set it to **Browser** to use your browser's timezone, or choose a specific timezone such as **UTC** or **America/New_York**.


**Per-query override with SET**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghudgins do we want to document at kibana the SET workaround? it won't work great as per our decision back then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we update to say this property is set by kibana and will be overridden?

Copy link
Contributor

@stratoula stratoula Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't be overriden. Kibana will take the value returned from ES (with the timezone of SET) and apply the timezone of the advanced settings. So I am not sure this works as expected. And we had agreed it won't if you remember

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only tested simple cases where it seemed to work so happy to take it out if needed, but because this is supported AND documented on the ES side, we need to be clear about how it works/doesn't work/isn't supported or wanted in Kibana and why

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure it works and the numbers make sense? Does the SET timezone is respected or the advanced settings one?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I looked into it, indeed it will work ok in Discover. But with a possible confusing outcome.

The tricky part is with date histograms such as BUCKET(@timestamp, 3 hour). ES|QL bucketed using Athens timezone boundaries — so 00:00, 03:00, 06:00 etc. are aligned to Athens midnight. If the user's dateFormat:tz (the advanced setting) is set to UTC, those bucket boundaries would display as 22:00, 01:00, 04:00 — which are correct instants but look like odd bucket boundaries.

For the above reason but also because we don't want users to create dashboards with different timezones as we don't have any UI logic about it (and we don't intend to have)

Here is the decision made back then:

  • The editor won’t suggest the timezone in SET, neither the function level timezones
  • Kibana apps will just support the space setting formatting and nothing else
  • We won’t add labels in the dashboards indicating to the users that they use a different timezone

So now @florent-leborgne and @ghudgins having all this info in mind wdyt we should do?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we don't suggest it that's fine. we can document it maybe with a warning about conflicts with space level settings. matches the pattern with SET with CPS where the query "wins" if the user chooses to configure it

Copy link
Contributor

@kosabogi kosabogi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one small suggestion

| STATS count = COUNT(*) BY BUCKET(@timestamp, 1 hour)
```

The editor does not suggest `SET time_zone` in autocomplete, but you can type it manually. You can also use it through the [Dev Tools Console](../tools/console.md) or the {{es}} API directly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could link the Elasticsearch API here: https://www.elastic.co/docs/api/doc/elasticsearch/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ES|QL] Support for approximate results

5 participants