# Document timestamp

**URL:** <https://discuss.elastic.co/t/document-timestamp/286955>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [October 18, 2021, 6:06am UTC](https://discuss.elastic.co/t/document-timestamp/286955 "2021-10-18T06:06:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reka.gay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/reka.gay/32/91470_2.png) [@reka.gay](https://discuss.elastic.co/u/reka.gay)\
**Post date:** [October 18, 2021, 6:06am UTC](https://discuss.elastic.co/t/document-timestamp/286955/1 "2021-10-18T06:06:42Z")

</div>

I'm updating the index with new/updated documents nightly. After each update, I perform a cleanup: getting all documents currently in the index and checking if they still should be present, based on the path field of each document.  
During update, I calculate the document ID based on the document title - which means that the ID changes in case the title changes, creating a duplicate document. However, given the path has not changed, the duplicated document will never be cleaned up.  
The first solution that pops into mind is to check if there are documents pointing to the same path, then delete the older one - but I need a timestamp for that. I was expecting elastic to keep a document creation timestamp but this doesn't seem to be present in the metadata through the app search API.  
Is there anything I can do apart from adding a timestamp manually?

---

<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 15, 2021, 6:07am UTC](https://discuss.elastic.co/t/document-timestamp/286955/2 "2021-11-15T06:07:21Z")

</div>

Closed on November 15, 2021, 6:07am UTC

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