On x Axis show biggest 20 Values, but in Ascending Order

Hi, I want to visualize the RAM usage of some builds.

As fields I have:

"metrics": { "ram": ram_value }  // on the y - Axis, and
"buildnumber": num                   //  on the x - Axis.

The maximum y - Value is the highest ram value, and on the x - Axis I am showing the last 20. Buildnumbers descending, right now.

What I actually want:
Show the last 20 Builds - But in an ascending order.

So I want to query the 20 highest values of Build-numbers. And after that I want to show those on the x - Axis.

Is that possible?

Sorry if I miss important information, I am a total Kibana beginner.

Welcome to our community! :smiley:

It should be possible yes. If you've tried to do this and you haven't gotten it working, posting some screenshots of your settings would help us direct you to a solution.

Hi. :slightly_smiling_face:
In the Discover tab I have an index vd_memory_usage which contains fields like that:

Every several hours I get new Build Number values in ascending order.

On the Visualize tab I have settings like that:

On the dashboard I want to show the last 20 Build-Numbers, but in ascending order from left..
Right now, if I set Buckets<X-Axis<Order<Ascending of course I miss many builds because in the Database they start at Buildnumber 600.

I tried to query in different ways on the Dev-Tools tab, but nothing worked fine for me.

It would be nice, if someone has an idea how to do that.

Is they only way to achieve that, using Scripted Fields, or is that even possible with those?

Because, with that query in Dev-Tools tab, I get the last 20 build numbers. (But still in descending order..)

GET /memory_usage/_search
{
  "query": {
    "match": {
      "test_env.build_job_name": "MyBuildJobName"
    }
  },
  "aggs": {
    "distinct_number": {
      "cardinality": {
        "field": "test_env.build_number"
      }
    },
    "test_env.build_number": {
      "top_hits": {
        "sort": [
          {
            "test_env.build_number": {
              "order": "desc"
            }
          }
        ],
        "size": 20
      }
    }
  }
}

Thanks in advance.

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