# How to know field is sortable or not

**URL:** <https://discuss.elastic.co/t/how-to-know-field-is-sortable-or-not/378124>\
**Category:** Kibana\
**Tags:** eql-elastic-query-language, discover\
**Created:** [May 14, 2025, 9:21am UTC](https://discuss.elastic.co/t/how-to-know-field-is-sortable-or-not/378124 "2025-05-14T09:21:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parthpuri\_Goswami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parthpuri_goswami/32/141878_2.png) [@Parthpuri\_Goswami](https://discuss.elastic.co/u/Parthpuri_Goswami)\
**Post date:** [May 14, 2025, 9:21am UTC](https://discuss.elastic.co/t/how-to-know-field-is-sortable-or-not/378124/1 "2025-05-14T09:21:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jughosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jughosta/32/107160_2.png) [@jughosta](https://discuss.elastic.co/u/jughosta)\
**Post date:** [May 14, 2025, 11:00am UTC](https://discuss.elastic.co/t/how-to-know-field-is-sortable-or-not/378124/2 "2025-05-14T11:00:18Z")

</div>

Hi @Parthpuri_Goswami and welcome to the community!

Discover page uses [DataView API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-getdataviewdefault) which calls [Elasticsearch field caps API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-field-caps). It then determines whether a field is [sortable or not](https://github.com/elastic/kibana/blob/bb877cff7ef24c3f7295bdcdbdebb960c7db81b3/src/platform/plugins/shared/data_views/common/fields/data_view_field.ts#L301-L310) based on it's type and [this Kibana mapping](https://github.com/elastic/kibana/blob/bb877cff7ef24c3f7295bdcdbdebb960c7db81b3/src/platform/packages/shared/kbn-field-types/src/kbn_field_types_factory.ts#L17)

---

<div class="post-metadata">

**Author:** ![Parthpuri\_Goswami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parthpuri_goswami/32/141878_2.png) [@Parthpuri\_Goswami](https://discuss.elastic.co/u/Parthpuri_Goswami)\
**Post date:** [May 14, 2025, 1:11pm UTC](https://discuss.elastic.co/t/how-to-know-field-is-sortable-or-not/378124/3 "2025-05-14T13:11:25Z")

</div>

Thanks for the response, I will check

---

<div class="post-metadata">

**Author:** ![Parthpuri\_Goswami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parthpuri_goswami/32/141878_2.png) [@Parthpuri\_Goswami](https://discuss.elastic.co/u/Parthpuri_Goswami)\
**Post date:** [May 15, 2025, 10:05am UTC](https://discuss.elastic.co/t/how-to-know-field-is-sortable-or-not/378124/4 "2025-05-15T10:05:09Z")

</div>

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](https://github.com/elastic/kibana/blob/e499dd4e6dd4148e0b3b4ea07865d823171602c8/src/platform/plugins/shared/data_views/common/fields/data_view_field.ts#L308)) 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?
