Skip to content

ESQL: Allow VALUES function to output values sorted by some other field. #132255

@przemekwitek

Description

@przemekwitek

Description

Currently, the VALUES function only accepts one parameter (field), see docs. The values in the output are not sorted.

There are cases though, where we would like to have an output list sorted by some other field. Think of a trendline use-case (see https://github.com/elastic/ml-team/issues/1595) for which we'd like to have output values sorted by their respective @timestamps in order to draw them as a trendline (sparkline).

For that, I propose extend the VALUES function by adding an optional second parameter (name TBD, let's use sortField for now) which will cause the output values to be sorted by their values of sortField.

The change is BWC since the new parameter will be optional.

The VALUES function will need to have access to 2 columns (channels): field and sortField.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions