Alphabetical sorting of numeric labels not working

I'm trying to order the response code labels in my stacked bar graph to be descending alphabetical, but it doesn't appear to be working properly. Further, when I select 'ascending', the response codes are re-ordered in some other non-alphabetical order. Please see screenshots of both cases below.

I believe this is a bug, as I've had other issues with alphabetical sorting in the past. It seems to be sorting on some other field or metric.

@Dennis1, welcome to the community!
In order to help you out, could you please let me know:

  1. What version of the stack are you using?
  2. How are you running kibana (from source, os etc)
  3. What your index pattern mappings are for the data you're visualizing

In this case, your visualization is doing the date aggregation first and then splitting the terms within each date, resulting in a sort within each bucket. The legend displays a rather naive concatenation of these sorted results and I have a feeling that's what's happening here.

Could you try swopping the order in which you are doing the aggregations? In other words, bucket with a split series by terms first and then use a date histogram on the X-axis.

I tested my recommendation using the kibana_sample_data_logs index as shown in the screen shot below:

I hope the example works for you.

Hi @cheiligers, thank you so much for your quick and helpful reply. What you suggested worked! I didn't think to reorder the timestamp bucket.

For reference, I am running Kibana 7.9.0 as a systemctl service on Ubuntu, installed from the debian package. My mappings for the status code are:

    "http": {
              "type": "object",
              "properties": {
                "response": {
                  "type": "object",
                  "properties": {
                    "status_code": {
                      "ignore_above": 1024,
                      "type": "keyword"

Thank you again!

I'm glad it worked for you!

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