# How to enable sorting for date fields in Kibana?

**URL:** https://discuss.elastic.co/t/how-to-enable-sorting-for-date-fields-in-kibana/122146
**Category:** Kibana
**Created:** [March 1, 2018, 7:55pm UTC](https://discuss.elastic.co/t/how-to-enable-sorting-for-date-fields-in-kibana/122146 "2018-03-01T19:55:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Olexandr](https://avatars.discourse-cdn.com/v4/letter/o/eb8c5e/32.png) [@Olexandr](https://discuss.elastic.co/u/Olexandr)
#### Post date: [March 1, 2018, 7:55pm UTC](https://discuss.elastic.co/t/how-to-enable-sorting-for-date-fields-in-kibana/122146/1 "2018-03-01T19:55:43Z")

</div>

I have an index formatted as follows:

```
PUT news
{
  "mappings": {
    "article": {
      "properties": {
        "pubdate": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ssZ"
          
        }
      }
    }
  }
}

```

I fill `pubdate` with values like `2017-01-05 23:42:21+02:00`. How to enable sort option for `pubdate` field in Kibana's Discover tab? More precisely I want a small triangle to appear near `pubdate` field in the table headings.

---

<div class="post-metadata">

### Author: ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)
#### Post date: [March 1, 2018, 9:29pm UTC](https://discuss.elastic.co/t/how-to-enable-sorting-for-date-fields-in-kibana/122146/2 "2018-03-01T21:29:45Z")

</div>

Date and number fields can be used for sorting for sure. Maybe Kibana is seeing the wrong type for your data, or perhaps the mappings in Elasticsearch aren't quote what you'd expect?

Take a look at the fields in the index pattern section in Kibana, and see if your `pubdate` field is marked as a date field. If not, check your [mappings in Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html). If it is a date field, there must be something else going on, but start by verifying the field type and mappings.

---

<div class="post-metadata">

### Author: ![Olexandr](https://avatars.discourse-cdn.com/v4/letter/o/eb8c5e/32.png) [@Olexandr](https://discuss.elastic.co/u/Olexandr)
#### Post date: [March 2, 2018, 5:30pm UTC](https://discuss.elastic.co/t/how-to-enable-sorting-for-date-fields-in-kibana/122146/3 "2018-03-02T17:30:26Z")

</div>

@Joe_Fleming, my `pubdate` field is indeed `string`. How do I set it as `date` apart from by what I have attempted already?

---

<div class="post-metadata">

### Author: ![Olexandr](https://avatars.discourse-cdn.com/v4/letter/o/eb8c5e/32.png) [@Olexandr](https://discuss.elastic.co/u/Olexandr)
#### Post date: [March 2, 2018, 6:11pm UTC](https://discuss.elastic.co/t/how-to-enable-sorting-for-date-fields-in-kibana/122146/4 "2018-03-02T18:11:15Z")

</div>

I kind of solved it just now. I removed index pattern, created index, formatted its mappings, uploaded data and then created index patterns again. Kibana set `pubdate` field as date and suggested that I use `pubdate` as time filter field.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 30, 2018, 6:11pm UTC](https://discuss.elastic.co/t/how-to-enable-sorting-for-date-fields-in-kibana/122146/5 "2018-03-30T18:11:41Z")

</div>

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