elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
303 stars 24.77k forks source link

[ES|QL] Add support for MAX/MIN aggregation on version field type #102126

Open herrBez opened 11 months ago

herrBez commented 11 months ago

Description

As documented ES|QL supports the version type. With this type, we can perform semantic versions comparisons like:

ROW v1 = to_version("1.2.0"), v2 = to_version("1.3.0")
| eval b = v1 > v2

Nevertheless as of now, it does not seem possible to perform min and max aggregation on this type:

ROW version = ["1.2.0", "3.5.0"]
| mv_expand version
| eval version = to_version(version)
| stats max(version)

The aggregation does not work, because:

argument of [max(version)] must be [numeric or datetime], found value [max(version)] type [version]

Screenshot:

image

Use-Case Find the biggest/smallest package version in a dataset (e.g., to verify which is the smallest version of a package in-use and check whether we have superseeded a given problem).

elasticsearchmachine commented 11 months ago

Pinging @elastic/es-ql (Team:QL)

elasticsearchmachine commented 11 months ago

Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL)

elasticsearchmachine commented 10 months ago

Pinging @elastic/es-analytics-geo (Team:Analytics)

cdwmhcc commented 6 months ago

Any update?