Sorting a percentile aggregation

Is it possible to sort a percentile aggregation? The query is:

  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "dttm": {
              "gte": "now-24h",
              "lte": "now"
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "resources": {
      "terms": {
        "field": "displayname.keyword",
        "size": 1000
      },
      "aggs": {
        "90_inpeak": {
          "percentiles": {
            "field": "inpeak_util",
            "percents": [
              90
            ]
          }
        },
        "per_sort": {
          "bucket_sort": {
            "sort": [
              {
                "90_inpeak": {
                  "order": "desc"
                }
              }
            ]
          }
        }
      }
    }
  }
}

The error on the return is:

{
  "error": {
    "root_cause": [],
    "type": "search_phase_execution_exception",
    "reason": "",
    "phase": "fetch",
    "grouped": true,
    "failed_shards": [],
    "caused_by": {
      "type": "aggregation_execution_exception",
      "reason": "buckets_path must reference either a number value or a single value numeric metric aggregation, got: org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.InternalTDigestPercentiles"
    }
  },
  "status": 503
}

TIA

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.