Skip to content

docs: document AI assistance in the ES|QL editor (#6552, #6681) - #6714

Merged
florent-leborgne merged 25 commits into
mainfrom
docs-issue-6552-esql-ai
Jun 22, 2026
Merged

florent-leborgne merged 25 commits into
mainfrom
docs-issue-6552-esql-ai

Conversation

@florent-leborgne

@florent-leborgne florent-leborgne commented May 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Documents the AI-assisted authoring features in the {{esql}} editor (preview in 9.5.0 and on Elastic Cloud Serverless) and consolidates all LLM-backed query generation on the page into one coherent section.

explore-analyze/query-filter/languages/esql-kibana.md

  • Adds a top-level Write and fix queries with AI section (#esql-kibana-ai-assistance, preview 9.5+) that groups every LLM-backed entry point, with a scope-based orientation (whole query vs. a single pipe vs. fixing errors) and a single shared requirements block (Enterprise license + LLM connector). It has three subsections:
    • Generate a full query from natural language (#esql-kibana-quick-search-nl) — the search bar's natural-language mode, moved here from the old search-bar section so all AI generation lives together (anchor preserved).
    • Generate {{esql}} from a comment (#esql-kibana-ai-comment, closes Write ES|QL faster with AI-assisted code completion in the editor #6552) — entry point, the order to follow (describe in a // comment first, then press {kbd}cmd+J), in-editor hints, placeholder, generating indicator, and Keep / Undo / Replace review actions, with a screenshot.
    • Fix query errors with AI (#esql-kibana-ai-fix, closes Fix ES|QL query errors with AI in the editor #6681) — the ✨ Fix with AI hover link and the Replace / Undo review actions, with screenshots of the entry point and the proposed-fix review state.
  • Refocuses the former "Build queries with KQL or natural language" section on KQL (now Build ES|QL queries from KQL syntax, #esql-kibana-quick-search), flattening the KQL procedure and linking out to the natural-language generator in the AI section.
  • Adds a cmd+J / ctrl+J row to the Keyboard shortcuts table (tagged preview 9.5+), pointing at the comment subsection.
  • Adds a mini-TOC of the Editor tools subsections and explicit heading anchors.
  • Updates the page frontmatter description to mention AI assistance.
  • In-editor hints are described in plain terms rather than quoting the exact UI strings, which are still being refined upstream (see note below).

explore-analyze/discover/discover-get-started.md

Source verification

All UI strings, shortcuts, and prerequisites verified at HEAD on elastic/kibana, and confirmed against screenshots from a running instance:

  • Ghost hints — src/platform/packages/private/kbn-esql-editor/src/comment_to_esql/use_ghost_line_hint.ts
  • Generating indicator — src/platform/packages/private/kbn-esql-editor/src/editor_ai.styles.ts
  • Comment-flow review buttons (Keep / Undo, with Keep → Replace in rewrite mode) — src/platform/packages/private/kbn-esql-editor/src/comment_to_esql/review_actions_widget.ts and use_comment_to_esql.ts
  • Fix-flow review widget renders Replace / Undo (⌘⇧↵ / ⌘⇧⌫). Note: use_suggest_fix.ts defines Keep AI fix / Undo AI fix, but those are command-palette action labels; the visible buttons are the shared review widget's Replace / Undo, as confirmed by screenshot.
  • ✨ Fix with AI hover link — src/platform/packages/shared/kbn-monaco/src/languages/esql/lib/providers/hover_provider.ts
  • Enterprise license + LLM connector gate (shared by all features) — src/platform/packages/private/kbn-esql-editor/src/hooks/use_nl_to_esql_check.ts
  • ⌘+J / Ctrl+J keyboard shortcut — src/platform/packages/private/kbn-esql-editor/src/editor_footer/keyboard_shortcuts.tsx

Reference PRs in elastic/kibana:

Related: A follow-up Kibana PR (elastic/kibana#274210) rewords the editor placeholder and the in-editor hints to make the "describe first, then press ⌘+J" order clearer. This page intentionally paraphrases those hints rather than quoting them, so it stays accurate regardless of the exact final wording.

Resolves

Closes #6552
Closes #6681


AI-generated draft — created with Claude Opus 4.7.
Review all generated content for factual accuracy before merging.

Add an AI assistance subsection covering comment-driven ES|QL generation and
"Fix with AI" on validation errors. Add the cmd+J/ctrl+J keyboard shortcut
and a cross-reference to the search bar's natural-language mode.

Co-authored-by: Cursor <[email protected]>
@github-actions

github-actions Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Elastic Docs AI PR menu

Check the box to run an AI review for this pull request.

Powered by GitHub Agentic Workflows and docs-actions. For more information, reach out to the docs team.

@github-actions

github-actions Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ Elastic Docs Style Checker (Vale)

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.

florent-leborgne added a commit that referenced this pull request Jun 8, 2026
…#6715)

## Summary

This PR addresses #6684 with the following changes:

- **`explore-analyze/discover/discover-get-started.md`**: Add a new `##
Analyze your data with AI` section covering the `discover-data-analysis`
skill, the {{esql}}-only scope, the auto-attached query context, and the
shape-specific guidance the agent receives when a context-aware profile
(logs, metrics, traces) is active. Add a one-line pointer in the
existing "Context-aware data exploration" section so readers landing
there discover that the active profile also tailors AI deep analysis.
-
**`explore-analyze/ai-features/agent-builder/builtin-skills-reference.md`**:
Add `discover-data-analysis` to the Platform skills list with its
assigned tools and the activation note, cross-linked to the new Discover
section.
- **`explore-analyze/discover/try-esql.md`**: Add a one-line tip after
"Refine an ES|QL query by interacting with the results table" pointing
to the new AI deep analysis section, so readers learning ES|QL in
Discover discover the feature too.

## Sibling PRs incorporated

The issue links elastic/kibana#267454 (context-aware playbook
contributions). Triangulating against the implementation file at HEAD
surfaced two additional sibling PRs that materially affect the
user-facing behavior:

- elastic/kibana#261970 — original Discover ↔ Agent Builder integration
that introduced the `discover-data-analysis` skill (9.5.0).
- elastic/kibana#268615 — added an automatic "Analyze my data" prompt
when opening AI Agent on a new {{esql}} tab.
- elastic/kibana#269846 — **reverted that auto-launch behavior** one day
before #267454 merged. This is not referenced in the issue. This PR
documents the post-revert behavior: opening AI Agent attaches the
Discover query context, but the user must still ask the agent to analyze
the data.

## Related work

This PR is complementary to #6714, which documents AI assistance
**inside the {{esql}} editor** (generating {{esql}} from a `//` comment
with `cmd+J`, and the **✨ Fix with AI** action on validation errors).
Together the two PRs cover the full AI-in-{{esql}} story: #6714 helps
you write or fix the query, this PR helps you analyze the results.

The two PRs introduce new anchors that don't exist on main yet, so
bidirectional cross-links between them are deferred. Whichever PR merges
second should add the cross-link in a small follow-up commit before
merge.

## Resolves

Closes #6684

---

> **AI-generated draft** — created with Claude Opus 4.7.
> Review all generated content for factual accuracy before merging.

---------

Co-authored-by: Cursor <[email protected]>
florent-leborgne and others added 10 commits June 17, 2026 11:06
…e and Discover AI analysis

Now that #6715 has merged, add the deferred cross-links: the editor AI
assistance section links to the Discover "Analyze your data with AI"
feature, and that section links back to the editor AI assistance.

Co-authored-by: Cursor <[email protected]>
Move "AI assistance" out from under "Editor tools" so it sits at the same
heading level as "Build queries with KQL or natural language", and bump its
two subsections to H4. The esql-kibana-ai-assistance anchor is unchanged, so
existing cross-links still resolve.

Co-authored-by: Cursor <[email protected]>
Clearer, action-oriented heading that reflects the two subsections and
parallels the sibling "Build queries with KQL or natural language". The
anchor is unchanged, so cross-links still resolve.

Co-authored-by: Cursor <[email protected]>
The Editor tools subsections are H4 and don't appear in the page's main
TOC, so add an in-section list linking to each. Add explicit anchors to the
subsections that lacked them so the links are stable.

Co-authored-by: Cursor <[email protected]>
Serverless availability is inferred for the keyboard shortcuts, matching the
other rows in the table.

Co-authored-by: Cursor <[email protected]>
The editor doesn't hold an editor-specific LLM connection: it uses Kibana's
default AI connector (the same one Agent Builder and other AI features use),
resolved server-side via the inference/agent-builder stack. Reword the intro
to avoid implying an editor-specific connection.

Co-authored-by: Cursor <[email protected]>
florent-leborgne and others added 11 commits June 19, 2026 19:24
Group all LLM-backed query authoring (natural language, comment-to-query,
fix errors) under the "Write and fix queries with AI" section with a
scope-based orientation, and refocus the search-bar section on KQL.

- Move "Generate a full query from natural language" under the AI section
  (anchor preserved), with the search bar section linking to it.
- Add a scope-based orientation list and consolidate the shared Enterprise
  license + LLM connector requirements into one block.
- Add stable anchors for the comment and fix subsections; point the cmd+J
  shortcut at the comment subsection.

Co-authored-by: Cursor <[email protected]>
- Rename the KQL section to "Build ES|QL queries from KQL syntax".
- Mark the "Write and fix queries with AI" section as preview 9.5 (all
  editor AI features are currently in preview); drop the now-redundant
  child tag and update the cmd+J shortcut row to match.
- Paraphrase the in-editor hints in plain terms instead of quoting the
  exact UI strings, which are still being refined upstream.

Co-authored-by: Cursor <[email protected]>
Add screenshots of the Fix with AI entry point and the proposed-fix
review state. Correct the review actions to match the on-screen widget
(Replace / Undo) rather than the command-palette action labels.

Co-authored-by: Cursor <[email protected]>
The replaced lines render with an amber highlight rather than a visible
strikethrough, so describe the color diff that users actually see.

Co-authored-by: Cursor <[email protected]>
Swap in a screenshot that shows the replaced line and the Replace action
more clearly, and align the alt text with the amber/green diff.

Co-authored-by: Cursor <[email protected]>
Replace the remaining markdown-style images with the {image} directive
and the :screenshot: option for consistent, framed rendering, preserving
alt text and widths.

Co-authored-by: Cursor <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Docs review summary

Focus areas

  • Style and clarity: Good overall. New AI sections are clear, well-structured, and follow the established how-to pattern. One LLM acronym ordering issue noted inline.
  • Jargon: LLM appears at line 118 (inside the refactored KQL section) before the expansion "large language model (LLM)" is introduced at line 139. See inline comment.
  • Frontmatter and applies_to: Description update is appropriate and within limits. applies_to tags and the JSON-style :applies_to: option in the tip directive match repository conventions.
  • Content type fit: The page remains a consistent how-to/reference hybrid; new sections follow the established pattern.
  • Parent issue satisfaction: Satisfied. #6552 (generate from comment) and #6681 (fix with AI) are each documented with entry-point description, steps, keyboard shortcuts, review actions, and screenshots.

Nits

  • Line 181 (esql-kibana.md): "Pressing the shortcut again cancels the in-flight request" — "in-flight" is developer jargon. Consider "cancels the active request" or "cancels the pending generation".

Notes

  • Vale findings in both files are all pre-existing issues outside the changed hunks; none introduced by this PR.
  • The cross-link addition to discover-get-started.md is clean and appropriate.

Generated by Docs review agent for issue #6714 · 137.9 AIC · ⌖ 25.6 AIC · ⊞ 32.9K

@florent-leborgne
florent-leborgne marked this pull request as ready for review June 19, 2026 18:07
@florent-leborgne
florent-leborgne requested review from a team as code owners June 19, 2026 18:07

@stratoula stratoula left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lovely ✨

@leemthompo leemthompo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reads good to me with some minor optional nits. Replacing "LLM" with "AI agent" is maybe more precise, but perhaps overkill 🤷.

@alaudazzi alaudazzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I left a few suggestions.

Co-authored-by: Liam Thompson <[email protected]>
Co-authored-by: Arianna Laudazzi <[email protected]>
Co-authored-by: Florent LB <[email protected]>
@florent-leborgne

Copy link
Copy Markdown
Member Author

Thanks for the reviews! Good point @leemthompo about rather using AI agent

@florent-leborgne
florent-leborgne enabled auto-merge (squash) June 22, 2026 09:12
@florent-leborgne
florent-leborgne merged commit 6a05f12 into main Jun 22, 2026
7 checks passed
@florent-leborgne
florent-leborgne deleted the docs-issue-6552-esql-ai branch June 22, 2026 09:13

This branch was successfully deployed

1 active deployment
docs-preview — 8a16b7b3 Deployed Jun 22, 2026 by github-actions[bot]
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.

Fix ES|QL query errors with AI in the editor Write ES|QL faster with AI-assisted code completion in the editor

4 participants