Skip to content
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

Sort terms agg by percentiles including decimal point #66677

Open
Tracked by #82808
flash1293 opened this issue Dec 21, 2020 · 4 comments
Open
Tracked by #82808

Sort terms agg by percentiles including decimal point #66677

flash1293 opened this issue Dec 21, 2020 · 4 comments
Labels
:Analytics/Aggregations Aggregations >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@flash1293
Copy link
Contributor

It's possible to sort a terms agg by a nested percentiles metric using the .<percentile value> (e.g. .95) suffix to select the right value out of the multi metric.

{
  "aggs": {
    "terms": {
      "terms": {
        "field": "geo.src",
        "size": 10,
        "order": {
          "percentiles.95": "asc"
        }
      },
      "aggs": {
        "percentiles": {
          "percentiles": {
            "field": "bytes",
            "percents": [
              95
            ]
          }
        }
      }
    }
  },
  "size": 0
}

However for percentiles including a decimal point this doesn't work because of limitations of bucket path parsing. E.g. for 95.3, neither the suffix .95.3 nor ['95.3'] work.

@flash1293 flash1293 added >enhancement needs:triage Requires assignment of a team area label labels Dec 21, 2020
@astefan astefan added the :Analytics/Aggregations Aggregations label Dec 21, 2020
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Dec 21, 2020
@elasticmachine
Copy link
Collaborator

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

@astefan astefan removed the needs:triage Requires assignment of a team area label label Dec 21, 2020
@polyfractal
Copy link
Contributor

Note to whomever looks at this bug in the future: pipeline aggs allow the ['foo'] syntax for things like selecting terms from a terms agg... but that uses a different resolution process than the sort resolution in the terms agg, hence the disparity

@wylieconlon
Copy link

If we're defining the ideal API, I would expect the syntax percentiles['99.5'] to work. Another option is doing a string replacement like percentiles.99_5 so that it's a valid key.

@drewdaemon
Copy link
Contributor

From @not-napoleon : this is the place to look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests

6 participants