# Index a document from Logstash using the ‘document\_id

**URL:** <https://discuss.elastic.co/t/index-a-document-from-logstash-using-the-document-id/67651>\
**Category:** Logstash\
**Created:** [November 30, 2016, 4:44pm UTC](https://discuss.elastic.co/t/index-a-document-from-logstash-using-the-document-id/67651 "2016-11-30T16:44:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![P-F](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/p-f/32/13504_2.png) [@P-F](https://discuss.elastic.co/u/P-F)\
**Post date:** [November 30, 2016, 4:44pm UTC](https://discuss.elastic.co/t/index-a-document-from-logstash-using-the-document-id/67651/1 "2016-11-30T16:44:26Z")

</div>

Hi  
Basically we want to be able to index a document from Logstash using the ‘document\_id’ parameter in the Elasticsearch output to overwrite\update a document and also use curator to delete anything older than 30days.

We have 2 options for this:

1. Have a single index so the document\_id parameter will function in our requirements were it overwrites\updates the existing document but the downfall of this is being able to delete indices older than 30days.
2. Have a day base index to allow us to delete data older than 30 days but the document\_id will only function if it is called on the same day. If a document is indexed the day after we get 2 documents with the same \_id, one in todays and one in yesterdays.

Is there a known work around for this

Thanks

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 5, 2016, 6:40am UTC](https://discuss.elastic.co/t/index-a-document-from-logstash-using-the-document-id/67651/2 "2016-12-05T06:40:02Z")

</div>

I think you're trying to have your cake and eat it. Document ids are only unique within a particular index, so if you want your document to be known by a single id you need a single index.

---

<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:** [January 2, 2017, 6:40am UTC](https://discuss.elastic.co/t/index-a-document-from-logstash-using-the-document-id/67651/3 "2017-01-02T06:40:21Z")

</div>

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