Problem when visualizing my custom date field

Hi,
I have a mapping like this:

"queuedtime":{
    "type": "date",
    "format": "dd-HH:mm:ss||d-HH:mm:ss||HH:mm:ss"
}

It works, and when I make a sort query like this one:

GET /slurm/_search
{
    "sort":[
        {"queuedtime": "asc"}
    ]
}

Works too, that is, the value returned by elasticsearch is the expected, is something like:

{
    "_index" : "slurm",
    "_type" : "doc",
    "_id" : "1",
    "_score" : null,
    "_source" : {
      "queuedtime" : "04:29:09",
      "@timestamp" : "2019-02-09T19:44:04.569Z"
    },
    "sort" : [
      16149000
    ]
  }

The problem is when I try to visualize this field, or query it in Discover, Kibana adds a very old date to this field, the matter is not the old date, the thing is that I don't want that date, I just want the hour without any date at all. Also, it modifies the hour, so the showed hour is not the original one. What Kibana shows:
January 2nd 1970, 23:29:09.000
Is it possible to just visualize the time without date?.

Note: I tried what was explained in this issues:

But I don't want more fields.
And this one:

But it does not work as expected, Kibana is still adding the date to my field.

Kibana can not support a date field that does not have year, month, and day. There is no way for kibana to know what year, month, and day the time occurs. You are seeing dates near January 1970 because time is represented as the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970. Since the year, month, and day are not provided, they just default to zero.

You can either

  1. populate the year, month, and day so the field is a valid date
  2. if you really just want the hour of day, then store the field as a number in elasticsearch and only store the hour of day, or minute of day, or what ever meets your usecase
1 Like

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