# Is there a way to make automated CREATED\_AT date field?

**URL:** https://discuss.elastic.co/t/is-there-a-way-to-make-automated-created-at-date-field/1043
**Category:** Elasticsearch
**Created:** [May 20, 2015, 10:41pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-make-automated-created-at-date-field/1043 "2015-05-20T22:41:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![virtuman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virtuman/32/49955_2.png) [@virtuman](https://discuss.elastic.co/u/virtuman)
#### Post date: [May 20, 2015, 10:41pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-make-automated-created-at-date-field/1043/1 "2015-05-20T22:41:35Z")

</div>

We do a lot of updating of the same documents and would be absolutely awesome to have a way for us to tell when the document was originally created. Our processing scripts push data to elasticsearch whenever new changes have been detected, however, we don't ever know in the processing scripts if the document had been previously pushed to Elasticsearch.

Having this datetime field automatically created and populate value just on the initial document create would allow us to generate many types of Date Histogram - driven reports.

Has anyone ever successfully been able to get this implemented in elasticsearch?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [May 20, 2015, 11:10pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-make-automated-created-at-date-field/1043/2 "2015-05-20T23:10:30Z")

</div>

Is this what you want? [https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html)

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [May 20, 2015, 11:27pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-make-automated-created-at-date-field/1043/3 "2015-05-20T23:27:11Z")

</div>

The update API let's you send the document to insert if it doesn't exist.  
If you add the current time to that that should get you pretty far.

---

<div class="post-metadata">

### Author: ![virtuman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virtuman/32/49955_2.png) [@virtuman](https://discuss.elastic.co/u/virtuman)
#### Post date: [May 21, 2015, 12:52am UTC](https://discuss.elastic.co/t/is-there-a-way-to-make-automated-created-at-date-field/1043/4 "2015-05-21T00:52:27Z")

</div>

No, this is for mapping \_timestamp to a document field value, it doesn't allow to set something like a current time as the default value if this value is not yet set in the document.

---

<div class="post-metadata">

### Author: ![virtuman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virtuman/32/49955_2.png) [@virtuman](https://discuss.elastic.co/u/virtuman)
#### Post date: [May 21, 2015, 12:54am UTC](https://discuss.elastic.co/t/is-there-a-way-to-make-automated-created-at-date-field/1043/5 "2015-05-21T00:54:05Z")

</div>

Nik, you probably missed that we cant specify different fields on product create and update. We push same data every time there's a change in the data. We always you full document index and always push ID together with it so it overwrites existing document's data and increments the version

---

<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: [July 6, 2017, 12:12am UTC](https://discuss.elastic.co/t/is-there-a-way-to-make-automated-created-at-date-field/1043/6 "2017-07-06T00:12:49Z")

</div>


