Sort by string in kibana's discover (search)

When I go to Kiban's discover and add fields I can sort on date field or Number field but I can't on string.

is this by design or I have to change some setting to enable this
I am using version 7.10.1

Is it a text or keyword in your mapping? You can't sort on text.

However, text field values are analyzed for full-text search while keyword strings are left as-is for filtering and sorting.

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

Do you need it to have a text mapping?

If you change it to the below it will work.

"error_name": {
 "type": "keyword"
}

But when a field also has a text mapping it won't let you sort. I am not sure if there is a way to specificy in Discover which one to use when you add a field to the table or not.

Actually you can. Never knew this option existed.

Click on Filter by Type and Hide Missing Fields then you can see your error_name.keyword.

image

1 Like

thank you @aaron-nimocks it worked exactly what I needed.

1 Like

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