How to enable sorting for date fields in Kibana?

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.

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. If it is a date field, there must be something else going on, but start by verifying the field type and mappings.

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

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.

1 Like

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