# Replace old documents

**URL:** https://discuss.elastic.co/t/replace-old-documents/207126
**Category:** Logstash
**Created:** [November 8, 2019, 2:10pm UTC](https://discuss.elastic.co/t/replace-old-documents/207126 "2019-11-08T14:10:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![shankaran](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@shankaran](https://discuss.elastic.co/u/shankaran)
#### Post date: [November 8, 2019, 2:10pm UTC](https://discuss.elastic.co/t/replace-old-documents/207126/1 "2019-11-08T14:10:59Z")

</div>

in My application Every day 6 times (4hrs per run) index will be updated by latest exchange rates documents.  
Any one could guide me on best approach how to delete my old documents (having SourceCurrency=USD) from logstash and insert new documents to elasticsearch (for SourceCurrency=USD)?

1. I have multiple documents for same SourceCurrency=USD.

![Capture](https://us1.discourse-cdn.com/elastic/original/3X/9/2/926c5926f0cd0cdafc6c9a9b85e8268c73ec6865.png)

1. I dont want to update price document. I have to delete all old price documents having (SourceCurrency=USD) and then new document should be inserted ( since every run number of documents will vary for same SourceCurrency=USD)
2. there is no document\_id i havent defined. i cant create document id with combination of SourceCurrency+DestinationCurrency since i may not sure will get same number of destination currency all time. i dont want to retain the destination currency which is not received in latest run.

---

<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: [December 6, 2019, 2:11pm UTC](https://discuss.elastic.co/t/replace-old-documents/207126/2 "2019-12-06T14:11:12Z")

</div>

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