# Date Field not properly recognised by Kibana 4

**URL:** https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082
**Category:** Kibana
**Created:** [January 18, 2017, 8:23pm UTC](https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082 "2017-01-18T20:23:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sharon.c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharon.c/32/16076_2.png) [@sharon.c](https://discuss.elastic.co/u/sharon.c)
#### Post date: [January 18, 2017, 8:23pm UTC](https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082/1 "2017-01-18T20:23:45Z")

</div>

I have two date fields in index, record\_time and @timestamp, the values of these two fields should be the same, and their format is different. record\_time is generated by php code, and @timestamp is generated by logstash automatically.

This is the screen catch of Kibana indice setting, you can see they are both recognised as date field

 ![](https://us1.discourse-cdn.com/elastic/original/2X/0/06937e4199e505e302032f2ffc456e63abc9c7c6.png)

This is the screen catch of the two field presentation in Kibana discover page  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/3/351fc9c4d16a48b9ba2497996c733c6e78e17ab2.png)

This is the screen catch of the raw data format of the two field presentation in Kibana discover page  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/6/6695a3981530905d9eeeffac9e37ff72900fbc73.png)

The following is screen catch when I use **record\_time** field range aggregation on Kibana to aggregate count for each hour

 ![](https://us1.discourse-cdn.com/elastic/original/2X/e/e13f5ca488522fb439a879a9a89c24fc49453b3a.png)

The following is screen catch when I use **@timestamp** field range aggregation on Kibana to aggregate count for each hour

 ![](https://us1.discourse-cdn.com/elastic/original/2X/b/b9bd5e5dc4645a7137931cef6901cc826d435c41.png)

You can see when I use **@timestamp** , I can get aggregated result, but when I use **record\_time** the aggregated result is not 0 ( kibana does not recognise record\_time field properly)

Not only in date range visualisation, but also other visualisation like date histogram, if I use record\_time the result is empty.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/d/d166086e45161edc67b08e3849dba716aec508e6.png)

How can I make Kibana use this field correctly?

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [January 18, 2017, 8:29pm UTC](https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082/2 "2017-01-18T20:29:35Z")

</div>

Hi Sharon,

See if this resolves your issue; [Date Histogram Problem](https://discuss.elastic.co/t/date-histogram-problem/71969)

Regards,  
Lee

---

<div class="post-metadata">

### Author: ![sharon.c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharon.c/32/16076_2.png) [@sharon.c](https://discuss.elastic.co/u/sharon.c)
#### Post date: [January 18, 2017, 8:45pm UTC](https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082/3 "2017-01-18T20:45:02Z")

</div>

Hi LeeDr, Thank you for your prompt reply.  
I actually tried, it still does not work.  
when I use @timestamp it works fine, I can see the data from discovery page,  
but when I choose record\_time when I add new index in kibana  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/a/a9b0140d6118e63232e2e97209a0812fa188cedf.png)  
It does not show any documents in the discover page.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/f/fae89817b3d8757ce7117b0d41e6e2027c61b81d.png)

Actually Elasticsearch does not respond properly if I use record\_time to do time range query in Sense interface, but if I use @timetamp to define the range, the result is correct:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/1dc2018cfe396bf5696a431f9f02bdb3d74a9fb6.png)

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [January 18, 2017, 10:07pm UTC](https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082/4 "2017-01-18T22:07:24Z")

</div>

Hi Sharon,  
What version of Kibana are you on? I might start up that version and try to replicate your case since I'm running a 5.x version.

I'm not sure yet what the problem is but I can show you what an index of mine with 2 date type fields looks like as a comparison.

In this index I have a `@timestamp` and `system.process.cpu.start_time`  
The date formats of both of mine are the same with the `T` between the date and time parts.  
And in the JSON view, after the \_source block, there is a "fields" block which shows those 2 timestamps with their milliseconds-since-the-epoch number format. Do you have that "fields" section? It might not be the same since I'm on 5.x and you're on Kibana 4.x.

And I confirmed I can create another index pattern using my `system.process.cpu.start_time` as the time-field name, and my Discover tab works fine.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/6/692dda881fe077d071caa9ddfa8678f355f78b6a.png)

And I also opened this to see the mapping; [http://localhost:9200/metricbeat-2017.01.18/\_mapping](http://localhost:9200/metricbeat-2017.01.18/_mapping) and I see those 2 date fields again.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/e/ec7025e8b63d1ea5beb821a27b0bb9d3d138c6f6.png)

---

<div class="post-metadata">

### Author: ![sharon.c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharon.c/32/16076_2.png) [@sharon.c](https://discuss.elastic.co/u/sharon.c)
#### Post date: [January 18, 2017, 11:11pm UTC](https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082/5 "2017-01-18T23:11:02Z")

</div>

I am using Kibana 4.5 with Elasticsearch 2.3  
Maybe my date field is not in correct format, that's why Elasticsearch does not use it properly.  
The date format I am using is in this format yyyy-mm-dd HH:mm:ss, when I use logstash to import the values and I defined this date field in elasticsearch template, there is no error from logstash during the importing process.

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [January 19, 2017, 7:51am UTC](https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082/6 "2017-01-19T07:51:41Z")

</div>

@sharon.c The one difference between those two fields is that the `@timestamp` includes time zone, so is converted to UTC before being indexed, while `record_time` doesn't and so is treated as UTC already.

In the screen capture of the raw data format, you can see that the two values aren't the same. `@timestamp` has time 19:49 while `record_time` has time `14:49`. In the screen cap of the field presentation just above that, the two dates are both rendered as 14:49, I think because Kibana sees that `@timestamp` has a time zone and so converts it to your local time zone.

I'm guessing at the reason here as I don't know how much data you have or what periods it covers. The raw JSON query that you show is a bit weird, as it is looking for data between Aug 1 2016 to Sep 7 2016.

Try doing the following:

```auto
GET elkstats_record_leads*/_validate_query?explain
{
  "query": {
    "range": {
      "@timestamp": {
        "gte": ".....some value...",
        "lte": ".....some value..."
      }
    }
  }
}

```

And then substitute `record_time` for `@timestamp` and compare the outputs

---

<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: [February 16, 2017, 7:52am UTC](https://discuss.elastic.co/t/date-field-not-properly-recognised-by-kibana-4/72082/7 "2017-02-16T07:52:23Z")

</div>

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