Visualize: Scripted field and median aggregation


after upgrading Kibana to 7.8.1 (also tested with 7.9.0) from 7.5.2 some visualizations using the median aggregation on scripted fields seem broken as they do not display anything. I could reproduce this quite easily:

  • Create a scripted field on a number field which in my case just reformats the ms to minutes
  • Create a e.g. bar visualization and use a "Median" aggregation for the "Y-axis" on the scripted field. The visualization displays nothing.

The response shows null for the 50th percentile:

      "took": 197,
      "timed_out": false,
      "_shards": {
        "total": 30,
        "successful": 30,
        "skipped": 15,
        "failed": 0
      "hits": {
        "total": 3548722,
        "max_score": null,
        "hits": []
      "aggregations": {
        "1": {
          "values": {
            "50.0": null

Interestingly the 50th percentile aggregation (which is basically the same right?) shows a result. Should I open a Github issue, I could not find an existing one? Just not sure if it is a Kibana or Elasticsearch issue.


Hi, I could not find a related issue either. Please go ahead and file a bug.

Does the issue only happen when the number field is a scripted field? Does the same thing happen for other aggregation types with numeric scripted fields?

Tbh I did not test all aggregation types but Average and Percentile at least work.

1 Like

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