Skip to content

[Metrics][Discover] Discover to prefer line chars for time series data#244595

Merged
crespocarlos merged 15 commits intoelastic:mainfrom
crespocarlos:236261-discover-prefer-line-chart-for-bucket-agg-poc
Dec 8, 2025
Merged

[Metrics][Discover] Discover to prefer line chars for time series data#244595
crespocarlos merged 15 commits intoelastic:mainfrom
crespocarlos:236261-discover-prefer-line-chart-for-bucket-agg-poc

Conversation

@crespocarlos
Copy link
Copy Markdown
Contributor

@crespocarlos crespocarlos commented Nov 28, 2025

closes #236261

Summary

Changes the call to Suggestion API in Discover to set the preferred char type as line if the query contains a timeseries bucket aggregation

Should work

image

Important

The scenario above depends on this PR #244753

image

Should not work
image

@crespocarlos crespocarlos force-pushed the 236261-discover-prefer-line-chart-for-bucket-agg-poc branch 2 times, most recently from 3444eab to f37dab2 Compare November 28, 2025 15:14
@crespocarlos crespocarlos force-pushed the 236261-discover-prefer-line-chart-for-bucket-agg-poc branch 3 times, most recently from 735f551 to ca5109f Compare December 1, 2025 11:18
@crespocarlos crespocarlos force-pushed the 236261-discover-prefer-line-chart-for-bucket-agg-poc branch from ca5109f to 4c88e52 Compare December 1, 2025 11:20
@crespocarlos crespocarlos changed the title [Metrics][Discover] Discover to prefer line chars for time series data POC [Metrics][Discover] Discover to prefer line chars for time series data Dec 1, 2025
@crespocarlos crespocarlos added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. Team:ESQL ES|QL related features in Kibana t// v9.3.0 labels Dec 1, 2025
@crespocarlos crespocarlos marked this pull request as ready for review December 1, 2025 14:31
@crespocarlos crespocarlos requested review from a team as code owners December 1, 2025 14:31
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@crespocarlos
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Thanx Carlos, it works ok! I have added some ideas on how to make this function a bit smarter. I dont think you need the bucketColumns logic. Check my last comment.

You also don't get into account the TBucket function which I am assuming is going to be the most popular one with timeseries.

Last but not least before we merge it, let's wait for this to get merged first #244753 (to test them together) and I am also seen some weird behavior in ES|QL in some cases, for example

TS kibana_sample_data_logstsdb | EVAL meow = DATE_TRUNC(1 hour, @timestamp) | STATS AVG(LAST_OVER_TIME(bytes)) BY meow

The above is another way to create time buckets and is not working correctly in ES|QL TS mode. I asked the team, so let's wait for them to respond first to see if we should also include it on our checks or not!

Copy link
Copy Markdown
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Tested locally, Data Discovery changes LGTM 👍

@crespocarlos
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@crespocarlos crespocarlos added Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation and removed Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. labels Dec 4, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-presentation-team (Team:obs-presentation)

@stratoula stratoula requested a review from a team as a code owner December 5, 2025 11:01
Copy link
Copy Markdown
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Thanx Carlos. ES|QL changes LGTM. I noticed a bug though when changing from one breakdown to another so I pushed a fix. The visualizations team needs to review

datasourceId?: string
) {
try {
const isSubtypeSupported =
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.

Adds another check for the validation of the subVisualizationId. This is important because the suggestions are being generated for all visualizations. So this is valid for XY but it is not for a partition. So we dont send it when it is not valid.

Without it if you change breakdowns (for example from TBUCKET to BUCKET) you will see a notification error.

…rsing_helpers.test.ts

Co-authored-by: Stratou <stratoula1@gmail.com>
@crespocarlos
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

Viz Code changes LGTM

@crespocarlos crespocarlos enabled auto-merge (squash) December 8, 2025 16:24
@crespocarlos crespocarlos merged commit cb12cc5 into elastic:main Dec 8, 2025
12 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dataVisualizer 597.5KB 597.1KB -420.0B
discover 1.3MB 1.3MB +546.0B
lens 1.6MB 1.6MB +129.0B
total +255.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dataVisualizer 29.3KB 29.3KB +9.0B
Unknown metric groups

API count

id before after diff
@kbn/esql-utils 171 174 +3

async chunk count

id before after diff
dataVisualizer 19 20 +1

History

mbondyra added a commit to mbondyra/kibana that referenced this pull request Dec 8, 2025
* commit '6647f813c9fa03ac0378e3d4756246e8dc4b4c76': (33 commits)
  [Detection Engine] Extracts Rules/Alerts/Exceptions permission to new Rules feature privileges (elastic#239634)
  [Agent Builder] Add Intro Tour (elastic#245551)
  Add datastream lifecycle support to indices metadata (elastic#245548)
  [Serverless] Update preconfigured connectors (elastic#245445)
  [Metrics][Discover] Discover to prefer line chars for time series data (elastic#244595)
  Update dependency @elastic/ebt to ^1.4.1 (main) (elastic#241629)
  [One Workflow] fix: request bodies with oneof schemas (`kibana.SetAlertsStatus`, etc) (elastic#245344)
  Update dependency ai to v5 (elastic#244675)
  Fix Discover trace waterfall behavior with duplicate spans (elastic#244984)
  [FSH] Migrated fs usage to kbn/fs for sample ingest (elastic#244163)
  Streamlang: Unskip type coercion test (elastic#245519)
  [Response Ops][Reporting] Fixing error in calculating delay value between retries (elastic#245431)
  Add TopNavMenuBeta to navigation plugin (elastic#243578)
  [scout] support custom servers configuration (elastic#244306)
  [Fleet] Run agentless background sync without dry run (elastic#245286)
  Fix Change Password Flaky Test (elastic#245443)
  Add new gap fill status for rules (elastic#242595)
  [Kibana Search] Move SLOs higher up in search results (elastic#245518)
  feat(slo): introduce find SLO instances internal route (elastic#245333)
  [FSH] Dropped unnecessary `fs` persistence for synthetics project code (elastic#244338)
  ...
maryam-saeidi added a commit to maryam-saeidi/kibana that referenced this pull request Feb 3, 2026
maryam-saeidi added a commit to maryam-saeidi/kibana that referenced this pull request Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Metrics in Discover release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Team:ESQL ES|QL related features in Kibana t// Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Metrics][Discover] Default to optimal chart type (Line vs Area) for time-series queries

8 participants