How to properly use elasicsearch boxplot aggregation?

I want to create a boxplot graph using plotly.js and elasticsearch.

Elasticsearch has an inbuild boxplot aggregation that returns this for each trace:

 "aggregations": {
    "load_time_boxplot": {
      "min": 0.0,
      "max": 990.0,
      "q1": 165.0,
      "q2": 445.0,
      "q3": 725.0,
      "lower": 0.0,
      "upper": 990.0

Right now i do something weird like this:

let polarityBuckets = i.aggregations.publisher.buckets;
let traces = {
  max: => e.polarity["max"]),
  min: => e.polarity["min"]),
  q1: => e.polarity["q1"]),
  median: => e.polarity["q2"]),
  q3: => e.polarity["q3"]),
  lowerfence: => {
    if (e.polarity["lower"] == "NaN") {
      return 0.0;
    } else {
      return e.polarity["lower"];
  upperfence: => e.polarity["upper"]),
  name: "test",
  type: "box",

But thats not even working, the graph looks so faulty.
I dont even know if max and min exist. The plotly boxplot config doesnt show min or max options, but when I hover over a trace it gives me the values for upper, lower … etc and min and max aswell.

Please help me on how to correctly and simply use the elasticsearch boxplot aggregation as one trace?
Thank you