# Issue with date field loaded in Kibana through elasticsearch

**URL:** <https://discuss.elastic.co/t/issue-with-date-field-loaded-in-kibana-through-elasticsearch/221724>\
**Category:** Kibana\
**Created:** [March 2, 2020, 4:05pm UTC](https://discuss.elastic.co/t/issue-with-date-field-loaded-in-kibana-through-elasticsearch/221724 "2020-03-02T16:05:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rainfall](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rainfall/32/91390_2.png) [@Rainfall](https://discuss.elastic.co/u/Rainfall)\
**Post date:** [March 2, 2020, 4:05pm UTC](https://discuss.elastic.co/t/issue-with-date-field-loaded-in-kibana-through-elasticsearch/221724/1 "2020-03-02T16:05:35Z")

</div>

Hi,

I have used logstash and loaded data through elasticsearch. I created indexpattern to the loaded index and trying to create visualization.  
I'm unable to create Date Histogram, since the date fields (closed\_at, work\_start) are showing up as string in Kibana.

These fields were configured in Logstash as Date type and show up as Date type in Elasticsearch. I had modified the scripted field to return this value as date. But it throws error in visualization. Please help.

Below is the error message:  
[esaggs] \> Request to Elasticsearch failed: {"error":{"root\_cause":[{"type":"aggregation\_execution\_exception","reason":"Unsupported script value [2015-07-06 11:56:23], expected a number, date, or boolean"}],"type":"search\_phase\_execution\_exception","reason":"all shards failed","phase":"query","grouped":true,"failed\_shards":[{"shard":0,"index":"bas-change","node":"Jqh-N9vqTGKKTWbjIAYXdw","reason":{"type":"aggregation\_execution\_exception","reason":"Unsupported script value [2015-07-06 11:56:23], expected a number, date, or boolean"}}]},"status":500}

---

<div class="post-metadata">

**Author:** ![Aaron\_Caldwell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron_caldwell/32/45755_2.png) [@Aaron\_Caldwell](https://discuss.elastic.co/u/Aaron_Caldwell)\
**Post date:** [March 2, 2020, 6:04pm UTC](https://discuss.elastic.co/t/issue-with-date-field-loaded-in-kibana-through-elasticsearch/221724/2 "2020-03-02T18:04:54Z")

</div>

Hello,

Double-check in Discover that it has in fact been encoded as a Date field. Depending on your version of Kibana, it should look something like this:

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/d/5d63c540fc37a5b153e434125dbb75b7758921e7.png)

If it looks like a `String` field instead, the problem is likely specific to your logstash configuration.

Regards,  
Aaron

---

<div class="post-metadata">

**Author:** ![Rainfall](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rainfall/32/91390_2.png) [@Rainfall](https://discuss.elastic.co/u/Rainfall)\
**Post date:** [March 3, 2020, 4:27pm UTC](https://discuss.elastic.co/t/issue-with-date-field-loaded-in-kibana-through-elasticsearch/221724/3 "2020-03-03T16:27:29Z")

</div>

Thanks Aaron. We got this fixed today. We had an issue with the scripted field code and its working fine now.

---

<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 31, 2020, 4:31pm UTC](https://discuss.elastic.co/t/issue-with-date-field-loaded-in-kibana-through-elasticsearch/221724/4 "2020-03-31T16:31:56Z")

</div>

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