# Automatic @timestamp in datastream

**URL:** <https://discuss.elastic.co/t/automatic-timestamp-in-datastream/286381>\
**Category:** Elasticsearch\
**Tags:** ingest-pipeline\
**Created:** [October 11, 2021, 3:14pm UTC](https://discuss.elastic.co/t/automatic-timestamp-in-datastream/286381 "2021-10-11T15:14:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggab31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ggab31/32/82454_2.png) [@ggab31](https://discuss.elastic.co/u/ggab31)\
**Post date:** [October 11, 2021, 3:14pm UTC](https://discuss.elastic.co/t/automatic-timestamp-in-datastream/286381/1 "2021-10-11T15:14:00Z")

</div>

Hi

The documentation says that documents must contain a @timestamp field in order to be accepted by a datastream.  
I'm trying to make it optional by declaring a default ingest\_pipeline in a datastream template that will automatically add a timestamp field. It works perfectly when I use a simple index template instead. Unfortunatly, it doesn't seem to work with a datastream template ("data stream timestamp field [@timestamp] is missing").  
So my question is : Do you think it's possible to automatically add a @timestamp to a document with an ingest pipeline so that a datastream can accept it ?

Thank you for your help

---

<div class="post-metadata">

**Author:** ![ggab31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ggab31/32/82454_2.png) [@ggab31](https://discuss.elastic.co/u/ggab31)\
**Post date:** [October 12, 2021, 12:26pm UTC](https://discuss.elastic.co/t/automatic-timestamp-in-datastream/286381/2 "2021-10-12T12:26:22Z")

</div>

Well, after several attempts, I can say that not only it's indeed possible, but it works perfectly.  
My problem was only due to a mistake in my ingest pipeline (it was creating the field "ingest\_timestamp" instead of "@timestamp"). Now I'm able to send simple status documents without timestamp to my datastream which adds itself the @timestamp field 🙂

---

<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:** [October 13, 2021, 12:21am UTC](https://discuss.elastic.co/t/automatic-timestamp-in-datastream/286381/4 "2021-10-13T00:21:04Z")

</div>

Thanks for sharing that solution!

---

<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:** [November 10, 2021, 12:21am UTC](https://discuss.elastic.co/t/automatic-timestamp-in-datastream/286381/5 "2021-11-10T00:21:50Z")

</div>

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