# Deleting documents based on timestam

**URL:** https://discuss.elastic.co/t/deleting-documents-based-on-timestam/66506
**Category:** Elasticsearch
**Created:** [November 18, 2016, 8:15am UTC](https://discuss.elastic.co/t/deleting-documents-based-on-timestam/66506 "2016-11-18T08:15:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![rajkumar3v](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rajkumar3v](https://discuss.elastic.co/u/rajkumar3v)
#### Post date: [November 18, 2016, 8:15am UTC](https://discuss.elastic.co/t/deleting-documents-based-on-timestam/66506/1 "2016-11-18T08:15:54Z")

</div>

Hello Experts,

I want to delete some events based on time stamp, below once is the time stamp of an server event which unnecessarily pushed same data multiple times with in a minute, for a minute single time stamp with doc is enough and need to delete others.

2016-10-21T15:44:02.8364001  
2016-10-21T15:44:13.8364025  
2016-10-21T15:44:23.8364050  
2016-10-21T15:44:45.8364052  
2016-10-21T15:44:59.8364082

Hepl me to resolve this.

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [November 18, 2016, 8:55am UTC](https://discuss.elastic.co/t/deleting-documents-based-on-timestam/66506/2 "2016-11-18T08:55:40Z")

</div>

You could just search for these particular timestamps, get the ids of the documents that you want to remove and then delete them by id.

---

<div class="post-metadata">

### Author: ![rajkumar3v](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rajkumar3v](https://discuss.elastic.co/u/rajkumar3v)
#### Post date: [November 18, 2016, 9:11am UTC](https://discuss.elastic.co/t/deleting-documents-based-on-timestam/66506/3 "2016-11-18T09:11:48Z")

</div>

Thank u Adrien,

for fewer events i can search and delete but i have 1000's of events like this and because of this excess documents my index size is getting bigger. is it possible to pick a single timestamp and remove others.. ?

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [November 18, 2016, 9:14am UTC](https://discuss.elastic.co/t/deleting-documents-based-on-timestam/66506/4 "2016-11-18T09:14:49Z")

</div>

Maybe you could automate the process using scipting?

---

<div class="post-metadata">

### Author: ![rajkumar3v](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rajkumar3v](https://discuss.elastic.co/u/rajkumar3v)
#### Post date: [November 18, 2016, 10:17am UTC](https://discuss.elastic.co/t/deleting-documents-based-on-timestam/66506/5 "2016-11-18T10:17:38Z")

</div>

yes am trying via API/CURL but can not filter a single timestamp from multiple, for this i can differentiate timestamp with their seconds interval and keep any one record and delete others is difficult.

---

<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 16, 2016, 10:18am UTC](https://discuss.elastic.co/t/deleting-documents-based-on-timestam/66506/6 "2016-12-16T10:18:34Z")

</div>

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