Add Visualizations API examples to Lens chart pages#5645
Draft
florent-leborgne wants to merge 5 commits intoelastic:mainfrom
Draft
Add Visualizations API examples to Lens chart pages#5645florent-leborgne wants to merge 5 commits intoelastic:mainfrom
florent-leborgne wants to merge 5 commits intoelastic:mainfrom
Conversation
Contributor
Contributor
Vale Linting ResultsSummary: 1 suggestion found 💡 Suggestions (1)
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. |
Add "Create this chart using the API" collapsible dropdowns after each individual example and advanced scenario across all 13 chart type pages. Each dropdown contains a cURL payload that recreates the described chart via POST /api/visualizations. 50 dropdowns total covering: - 27 chart examples (matching UI-built configurations) - 13 advanced scenarios (time shifts, reference lines, stacked bars, etc.) - Multiple chart types per payload pattern Also adds a Visualizations API intro section to the main Lens page with links to both stateful and serverless API docs. All sections gated with applies_to: stack: preview 9.4 / serverless: preview. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
176d5d8 to
b0225f6
Compare
Switch from code block applies_to inside dropdowns to the :applies_to: directive option syntax per docs-builder conventions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove bash-specific quote escaping from JSON payloads in cURL examples. Single quotes inside JSON strings are valid and don't need escaping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixes validated against a 9.4 snapshot with all sample datasets: - Move dataset inside XY layers (area, bar, line charts) - Fix field names: slice_by→group_by, x_axis→x, tags→tag_by, etc. - Remove null values (API rejects nulls for optional fields) - Fix split_metrics_by to be an array - Fix other_bucket to use object format - Fix filters operation structure in group_by - Fix formula quoting (bare single quotes, no shell escaping) 39 of 50 payloads now pass integration tests. The 11 remaining failures are all caused by the same runtime bug: the minMaxAvgMedianStdDevMetricOperation discriminator doesn't resolve, so operations like average/min/max fail validation. These payloads are structurally correct per the spec and will work once the discriminator bug is fixed. Tracked in VISUALIZATIONS_API_DISCREPANCIES.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Key fixes: - metric charts: add type:primary/secondary, alignments, icon fields - gauge charts: fix color step structure - line charts: fix moving_average to use nested "of" field - bar charts: fix reference line layer to use thresholds array - tables: fix split_metrics_by to be array All 50 payloads now create visualizations successfully against a live Kibana 9.4 snapshot with sample data loaded. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add "Create this chart using the API" collapsible dropdowns to all 13 Lens chart type documentation pages plus an API intro section to the main Lens page. Each dropdown contains a cURL payload that recreates the described chart via POST /api/visualizations.
What is included
Integration test results
50/50 payloads pass against a live Kibana 9.4 snapshot with all three sample datasets loaded. Every payload creates a visualization successfully and is cleaned up after testing.
Testing script: kibana:oas_docs/scripts/validate_viz_examples.js
Test plan