How to know field is sortable or not

Hi Everyone,

In my application, I want to sort fields similar to the Kibana Discover page. After exploring the Kibana Discover page, I found that some fields are not sortable, meaning the sort functionality is disabled for them. Is there any way I can determine which fields are sortable and which are not? I have explored some Kibana APIs but couldn't find anything.

For example, the geo point field is not sortable, and the sorting feature is disabled. So, is depends on datatype or data?

Kibana version: v8.18.1

Hi @Parthpuri_Goswami and welcome to the community!

Discover page uses DataView API which calls Elasticsearch field caps API. It then determines whether a field is sortable or not based on it's type and this Kibana mapping

Thanks for the response, I will check

Hi @jughosta , I have checked and tried to understand the code, but while reviewing it, I found that this.spec.indexed (kibana/src/platform/plugins/shared/data_views/common/fields/data_view_field.ts at e499dd4e6dd4148e0b3b4ea07865d823171602c8 · elastic/kibana · GitHub) is used to build a condition. However, after looking around, I couldn't find what it is or how to get it from the Dataview API. Could you help me understand what it is and where I can get it?