Dashboard: "options list" entries sorting

Hi,

We are using filtering controls in our dashboards ("Options List").

Specifically, one of our controls is for the following field:

"session_id": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }

I'm having a hard time understanding how the entries in the list are sorted. I would assume they're sorted alphabetically, but this still doesn't explain the behavior we're seeing.

sorting

Can you please explain how sorting works and if there's any workaround that we can leverage to have our entries sorted numerically ?

The highlighted entries in the image above have the same length, so even if they were sorted lexicographically I would expect them to be in order.

Elastic version: 8.5.2

Thanks

Thanks for your question, @hkhalil!

Before v8.7, the options list suggestions were always sorted descending by document count - i.e., the values that are most common in your data would show up at the top, descending from there. This is what you are currently seeing - this means that 104490 occurs more often than 106959 which occurs more than 101290, which is why you are seeing that ordering.

Once v8.7, is released, you will see that we added support for dynamic sorting - i.e. you will have the ability to sort by either document count or alphabetically, ascending or descending. Here's a quick little GIF of this in action:

Jan-16-2023 11-11-34

Note that you might still get slightly unexpected results when selecting alphabetical sorting for a numeric string, as alphabetical sorting is doing a string comparison and not a numerical comparison. So, "10" is actually less than "2" because it's only comparing the first character of "10" and "1" < "2". This should be resolved once we had the ability to create options list controls on numeric fields :+1:

3 Likes

Hi @Hannah_Mudge !

Thank you for the clear explanations and sharing features we can look forward to. These will definitely come in handy.

In terms of both v8.7 and options list controls on numeric fields, is there a release window for them ?

Kind regards,
Hussein

@hkhalil The planned release for v8.7 is in late March, 2023. Adding support for numeric fields is on our roadmap for v8.8 - you can keep track of the related issue here :+1:

2 Likes

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