# How to add date mapping in existing template

**URL:** <https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853>\
**Category:** Elasticsearch\
**Created:** [August 22, 2017, 5:58am UTC](https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853 "2017-08-22T05:58:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonesthomas](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jonesthomas](https://discuss.elastic.co/u/Jonesthomas)\
**Post date:** [August 22, 2017, 5:58am UTC](https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853/1 "2017-08-22T05:58:59Z")

</div>

i have a default filebeat template, How to add date filed in that existing template.?  
For example;  
in log i have Time field as string i need to convert into timestamp field,  
I tried with logstash , the Time filed is changed from  
Time : 2017-08-21\_03:44:31.190 `to`  
timestamp: 2017-08-21T03:44:31.190Z  
i got the timestamp converted properly But timestamp is still showing as string field in kibana.  
my sample conf:  
`date { match => ["Time","yyyy-MM-dd_HH:mm:ss.SSS"] timezone => "UTC" target => "timestamp" }`

1- How do i map timestamp as date field

---

<div class="post-metadata">

**Author:** ![Mojster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mojster/32/21209_2.png) [@Mojster](https://discuss.elastic.co/u/Mojster)\
**Post date:** [August 22, 2017, 6:06am UTC](https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853/2 "2017-08-22T06:06:29Z")

</div>

I'm using this for my date in LS and is working properly.

```auto
date {
	locale => "en"
	match => ["returnDate", "dd.MM.YYYY"]
	timezone => "Europe/Ljubljana"
	target => "returnDate"
}

```

Maybe it isn't working because you left out `locale` property.

After your example you'll have a field `timestamp` and a field `Time`. I'm assuming you don't need `Time` any more so just unset/remove it.

---

<div class="post-metadata">

**Author:** ![Jonesthomas](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jonesthomas](https://discuss.elastic.co/u/Jonesthomas)\
**Post date:** [August 22, 2017, 6:10am UTC](https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853/3 "2017-08-22T06:10:26Z")

</div>

thaks for your reply. yeah i tried but both timestamp and Time is showing as string in kibana..

---

<div class="post-metadata">

**Author:** ![Mojster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mojster/32/21209_2.png) [@Mojster](https://discuss.elastic.co/u/Mojster)\
**Post date:** [August 22, 2017, 6:24am UTC](https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853/4 "2017-08-22T06:24:24Z")

</div>

I've checked the documentation. So `locale` is not required. So this is not the case.

When I was configuring my dates in LS, I needed to remove my index and create it again. After that my fields were ok.  
I'm not sure if this is the case. Would recommend, that you post your date in a new (never used) field. If this is ok, then reindex or remove/index your index.

---

<div class="post-metadata">

**Author:** ![Jonesthomas](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jonesthomas](https://discuss.elastic.co/u/Jonesthomas)\
**Post date:** [August 22, 2017, 6:30am UTC](https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853/5 "2017-08-22T06:30:49Z")

</div>

> [@Mojster](#):
>
> I’ve checked the documentation. So locale is not required. So this is not the case.
> 
> When I was configuring my dates in LS, I needed to remove my index and create it again. After that my fields were ok.
> 
> I’m not sure if this is the case. Would recommend, that you post your date in a new (never used) field. If this is ok, then reindex or remove/index your index.

i posted my date in a new and never used field called `date`, Time is converted to date but still Showing as string  
`date :2017-08-21T03:44:31.953Z`

---

<div class="post-metadata">

**Author:** ![Mojster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mojster/32/21209_2.png) [@Mojster](https://discuss.elastic.co/u/Mojster)\
**Post date:** [August 22, 2017, 6:45am UTC](https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853/6 "2017-08-22T06:45:39Z")

</div>

Did you just checked this in results or did you also checked your mapping?  
If you didn't, you can check you fields under Kibana/Management or you just select your mapping with

```auto
GET /YOUR INDEX/_mapping/

```

---

<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:** [September 19, 2017, 6:45am UTC](https://discuss.elastic.co/t/how-to-add-date-mapping-in-existing-template/97853/7 "2017-09-19T06:45:50Z")

</div>

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