Skip to content

[not ready] Document grouped view for ES|QL STATS results in Discover#5457

Closed
florent-leborgne wants to merge 3 commits intomainfrom
docs/discover-grouped-stats-results
Closed

[not ready] Document grouped view for ES|QL STATS results in Discover#5457
florent-leborgne wants to merge 3 commits intomainfrom
docs/discover-grouped-stats-results

Conversation

@florent-leborgne
Copy link
Copy Markdown
Member

Summary

  • Adds a new "Explore STATS results in a grouped view" section to the Using ES|QL in Discover page.
  • Documents the Group by selector (with Technical Preview badge), expandable group rows, and row actions (Copy to clipboard, Filter in, Filter out, Open in new tab).
  • Describes conditions for the grouped view: requires STATS ... BY with a single BY field, not using grouping functions like BUCKET.
  • Includes a placeholder for a screenshot (commented out in the source).

Closes #4959

Availability check needed

The cascade/grouped view is gated behind a feature flag (discover.cascadeLayoutEnabled, which defaults to false in the code). We need to confirm:

  • Is this flag enabled by default in 9.4 / serverless production?
  • The UI shows a "Technical preview" badge (added in #255725), so the applies_to tag may need to be preview rather than ga.

Additional PRs merged since the original issue was filed (Feb 3)

The cascade feature has had significant ongoing development since the issue was created:

PR Description
#255725 Add tech preview badge to cascade switch button
#256630 Specify strict layout guidance for rows and cells
#251154 Support group by fetching across tabs
#248838 Improvements to cascade component from Discover usage
#251536 Resolve stuttering in cascade component
#253819 Add consideration for inline cast to cascade capture rules

Related Kibana PRs

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-opus-high in Cursor

Made with Cursor

Add a new section about the grouped (cascade) view that appears
when running STATS ... BY queries with a single BY field. Documents
the Group by selector, expandable rows, row actions, and conditions
for when the grouped view is available.

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

github-actions Bot commented Mar 11, 2026

Vale Linting Results

Summary: 1 suggestion found

💡 Suggestions (1)
File Line Rule Message
explore-analyze/discover/try-esql.md 344 Elastic.Ellipses In general, don't use an ellipsis.

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
Copy Markdown
Contributor

github-actions Bot commented Mar 11, 2026

🔍 Preview links for changed docs

The actions are accessed via a row action button (three dots menu),
not a right-click context menu. Also fixes the icon name to
boxes_horizontal to match the docs-builder convention.

Made-with: Cursor
@florent-leborgne
Copy link
Copy Markdown
Member Author

This will stay as draft for now as the feature isn't fully released yet, only some code has shipped

@florent-leborgne florent-leborgne changed the title Document grouped view for ES|QL STATS results in Discover [not ready] Document grouped view for ES|QL STATS results in Discover Mar 13, 2026
florent-leborgne added a commit that referenced this pull request Apr 28, 2026
- Note that BUCKET and TBUCKET in BY don't trigger the grouped layout
  (only single-field grouping or CATEGORIZE), per
  SUPPORTED_STATS_COMMAND_OPTION_FUNCTIONS in kbn-esql-utils.
- Add three screenshot TODO placeholders covering the overview, the
  CATEGORIZE+SPARKLINE row, and the row actions menu.

Carries over the BUCKET/TBUCKET caveat from #5457 so it can be closed
as superseded.

Made-with: Cursor
@florent-leborgne
Copy link
Copy Markdown
Member Author

Superseded by #6190.

The new PR covers the same grouped view + Group by selector + row actions you started here, plus:

  • The CATEGORIZE pattern token rendering and the inline SPARKLINE rendering (recommended example query included).
  • A reciprocal tip on explore-analyze/discover/run-pattern-analysis-discover.md so the classic Patterns page points readers to the ES|QL grouped view.
  • The BUCKET/TBUCKET caveat from this PR is carried over (verified against SUPPORTED_STATS_COMMAND_OPTION_FUNCTIONS = ['categorize'] in kbn-esql-utils).
  • A "Hold for release" checklist tracking the three gates: elastic/elasticsearch#146853, Stack 9.4.0 GA, and the Serverless LD flip (target week of 2026-05-05).

End-to-end verification done on a local 9.4 snapshot Kibana + Elasticsearch build with a Trial license.

Closing this one. The branch you started here (docs/discover-grouped-stats-results) is no longer needed.

florent-leborgne added a commit that referenced this pull request May 5, 2026
…S|QL (#6190)

## ⛔ Hold for release

**Do not merge before all of the following ship:**

- [ ] Stack 9.4.0 GA released.
- [ ] Cascade layout LaunchDarkly flag flipped on for production
Serverless (target: week of 2026-05-05).

Until those gates are met, the cascade layout is invisible on production
Serverless and ECH, even though the supporting Kibana code has shipped.

## Summary

Documents the ES|QL `CATEGORIZE` UX enhancements that ship in Kibana 9.4
and Serverless preview:

- New "View grouped results from a STATS query" section in
`explore-analyze/discover/try-esql.md` covering:
- The cascade (grouped) layout for ES|QL `STATS BY` queries with a
single grouping field.
  - The `BUCKET`/`TBUCKET` and multi-field exclusion.
- The **Group by** selector (with technical preview badge), the results
count, and the opt-out path.
  - `CATEGORIZE` pattern token rendering, with a single-query example.
- Grouped row actions (Copy to clipboard, Filter in, Filter out, Open in
new tab).
- Reciprocal tip on the existing classic-mode pattern analysis page
(`explore-analyze/discover/run-pattern-analysis-discover.md`) pointing
to the new ES|QL section.

Closes #5733.
Supersedes #5457 (carries over the BUCKET/TBUCKET caveat as a
single-paragraph clarification).

### SPARKLINE deferral

`SPARKLINE` was originally part of this PR but has been deferred from
9.4 to 9.5. The combined `CATEGORIZE` + `SPARKLINE` example, the
`SAMPLE` scaling tip, and the sparkline screenshot are commented out in
the markdown source inside a clearly-marked `RESTORE FOR 9.5` block. The
reciprocal tip on the pattern analysis page no longer mentions
sparklines. Restore work is tracked in #6215.

## Verification

All scenarios still in scope verified on a local 9.4 snapshot Kibana +
Elasticsearch build with a Trial license:

1. Single-field `STATS BY` triggers the grouped layout with the **Group
by** selector and "N groups" results count.
2. Multi-field `STATS BY` falls back to the flat table.
3. `BUCKET`/`TBUCKET` grouping queries fall back to the flat table.
4. **Group by** → **none** opt-out switches back to flat and restores
the regular toolbar.
5. Grouped row actions (Copy / Filter in / Filter out / Open in new tab)
all behave as documented.
6. `CATEGORIZE` renders patterns with token highlighting.

(`CATEGORIZE` + `SPARKLINE` was also verified on the local snapshot
build before the SPARKLINE content was deferred.)

## Source verification

Cross-checked against `elastic/kibana` `main` and the `9.4` branch:

- Cascade gating (`isCascadedDocumentsVisible`,
`SUPPORTED_CASCADE_GROUPING_COUNT = 1`) in
`cascaded_documents_provider.tsx`.
- Feature flag fallback `true` in `build_services.ts`, set by
[`elastic/kibana#260698`](elastic/kibana#260698)
and present on the 9.4 branch.
- Supported grouping functions list:
`SUPPORTED_STATS_COMMAND_OPTION_FUNCTIONS = ['categorize']` in
`kbn-esql-utils/src/utils/cascaded_documents_helpers/utils.ts` (this is
why BUCKET/TBUCKET don't trigger the cascade).
- Row actions and i18n labels in `use_row_header_components.tsx` and
`use_table_header_components.tsx`.

## Screenshots

One screenshot placeholder is inline in the diff as a commented-out
image directive:

1. Overview of the grouped layout (toolbar with the **Group by** button
replacing the standard toolbar, "N groups" results count, one expanded
row showing underlying documents).

The previously-planned `CATEGORIZE` + `SPARKLINE` row screenshot is
commented out alongside the SPARKLINE content; it will be restored as
part of #6215.

## Note on supersession

This PR replaces #6086 (which couldn't be reopened because the branch
HEAD has moved past the closed-state ref). The same branch
(`docs-issue-5733-categorize-ux`) is reused. #6086 is left closed for
history.

## Generative AI disclosure

- [x] Yes - drafted with Claude Opus 4.7 in Cursor.

---------

Co-authored-by: Benjamin Ironside Goldstein <91905639+benironside@users.noreply.github.com>
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.

Grouped view for ES|QL query results in Discover when the query uses STATS

1 participant