-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Lens] Enable ESQL multi-terms charts #244743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Lens] Enable ESQL multi-terms charts #244743
Conversation
stratoula
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marco I tested it a lot, especially the suggestions logic and I don't see any regressions. It actually works really well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
|
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
jughosta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data Discovery changes LGTM
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
History
|
| // remove categories one maching an assignment | ||
| return !assignmentMatcher.hasMatch(category); | ||
| }) | ||
| // setting the Map keys as the strinified version of the rawValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo stringified
| } | ||
| return `${splitValues.join(' - ')}${yAccessorTitle ? ' - ' + yAccessorTitle : ''}`; | ||
| return `${splitValues.join(MULTI_FIELD_KEY_SEPARATOR)}${ | ||
| yAccessorTitle ? ' - ' + yAccessorTitle : '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this ' - ' also be MULTI_FIELD_KEY_SEPARATOR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that's a different separator, this separates the breakdown categories (called splitValues and concatenated with the from the MULTI_FIELD_KEY_SEPARATOR) from the metric name
baileycash-elastic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actionable-obs changes lgtm
PhilippeOberti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review only, LGTM for the @elastic/security-threat-hunting-investigations team
| layers: Array<DeprecatedSplitAccessorLayer | XYLayerConfig>; | ||
| } | ||
|
|
||
| export function convertToSplitAccessorsFn(state: DeprecatedSplitAccessorState | XYState): XYState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this is an exact duplicate of the one in split_accessor.ts - should we move to a shared utility?
| legacyMode: boolean = false // stringifies raw values | ||
| ): SerializedValue[] { | ||
| if (!accessor) return []; | ||
| if (!accessors) return []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the default being now an array, should we consider it like this: (!accessors || accessors.length === 0) return [];
|
|
||
| const splits = | ||
| !column || !data.tables[layer.layerId] | ||
| !columns || !data.tables[layer.layerId] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a check for array length here too: !columns || columns.length === 0 | !data.tables[layer.layerId]
walterra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some local testing, LGTM! Tested:
- Used sample logs/flights
- In query mode, was able to add additional breakdown fields
- In form mode, only a single breakdown field can be used
- Reordering breakdown fields works
- ES|QL with multiple
BYs will add multiple fields to breakdowns
|
Hi @markov00 I'm mainly testing the UI in Discover, and it works really nicely overall. I do have a few questions, though. In the code, I don't see any explicit limitation on the number of dimensions. However, when using ES|QL, the charts seem to return a maximum of three dimensions. (am I missing something?) Screen.Recording.2026-01-07.at.1.38.14.PM.movAdditionally, with the following query: Screen.Recording.2026-01-07.at.1.39.27.PM.movThe legend appears in the order cloud.region → host.id → host.ip, as shown in recording above. |

Summary
This PR enables the possibility to configure ESQL charts with a multi-field breakdown.
The code changes are the following:
splitAccessor?: stringvisualization state parameter of XY charts intosplitAccesors?: string[]. This allows adding multiple separate column/dimension into that parameter, that was already available at the expression level to describe a breakdown formed by multiple data columns.multi-termsclass used for multi-terms aggregation. This class has already everything in place to contain 2 different values and also 2 different formatting options.>simbol.Fix #235743
Part of #236682
What is currently missing, and will be added in a subsequent PR: