# Date mapping issue

**URL:** <https://discuss.elastic.co/t/date-mapping-issue/371575>\
**Category:** Elasticsearch\
**Created:** [December 6, 2024, 8:52am UTC](https://discuss.elastic.co/t/date-mapping-issue/371575 "2024-12-06T08:52:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmdevheart](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rmdevheart](https://discuss.elastic.co/u/rmdevheart)\
**Post date:** [December 6, 2024, 8:52am UTC](https://discuss.elastic.co/t/date-mapping-issue/371575/1 "2024-12-06T08:52:31Z")

</div>

HI all, can't fight with it anymore, need help.  
I have an input 'localtime' field with text formatted as '2024-12-06 08:40:36.000404894'.  
Index mapping for this:

```auto
      "localtime": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss.nnnnnnnnn"

```

I have two troubles:  
In kibana view I see no precise values:

```auto
event.original
2024-12-06 08:40:53.000086923
localtime
2024-12-06 08:40:53.000000000

```

and second one - localtime stored as Keyword, so I can't use this field as default timestamp in Kibana (it's a point).

Stack version: 8.2.12

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 6, 2024, 9:48am UTC](https://discuss.elastic.co/t/date-mapping-issue/371575/2 "2024-12-06T09:48:01Z")

</div>

If you look at the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html) the `date` field type only supports millisecond accuracy. To get full accuracy for your field you would need to use the [date\_nanos](https://www.elastic.co/guide/en/elasticsearch/reference/current/date_nanos.html) field type.

> [@rmdevheart](#):
>
> Stack version: 8.2.12

This is getting quite old, so I would recommend you upgrade to the latest version.

---

<div class="post-metadata">

**Author:** ![rmdevheart](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rmdevheart](https://discuss.elastic.co/u/rmdevheart)\
**Post date:** [December 6, 2024, 10:59am UTC](https://discuss.elastic.co/t/date-mapping-issue/371575/4 "2024-12-06T10:59:26Z")

</div>

Oh, my bad. Correct version is 8.12.2.  
Also, changing to date\_nanos helps me to avoid inaccurate values, now its good with nanoseconds, thanks!  
But field is still stored as 'Keyword' with no possibility to use it as correct timestamp.

---

<div class="post-metadata">

**Author:** ![rmdevheart](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rmdevheart](https://discuss.elastic.co/u/rmdevheart)\
**Post date:** [December 6, 2024, 11:12am UTC](https://discuss.elastic.co/t/date-mapping-issue/371575/5 "2024-12-06T11:12:26Z")

</div>

Upd: changing existing kibana view don't allow to use 'localtime' as timestamp, but when I try to create new one with same index-pattern - I can choose 'localtime' as timestamp. Victory!
