# Delete docs by date

**URL:** <https://discuss.elastic.co/t/delete-docs-by-date/274493>\
**Category:** Kibana\
**Created:** [May 31, 2021, 11:48am UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493 "2021-05-31T11:48:57Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Manuel\_Tirado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_manuel_tirado/32/84882_2.png) [@Jose\_Manuel\_Tirado](https://discuss.elastic.co/u/Jose_Manuel_Tirado)\
**Post date:** [May 31, 2021, 11:48am UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/1 "2021-05-31T11:48:57Z")

</div>

HI!

In the following index I have several days of data

![image](https://us1.discourse-cdn.com/elastic/original/3X/a/6/a6cc2514aa6eb809cdb0e2452c1381944c606ae4.png)

I want to delete the data from the 29th and 30th of the 5th of 2021

But when I launch the following command I obtain this messages:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/6/c6f4856137c32a12b254e2f7172b4e278739f777.png)

How cai I delete the data of this dates??

Thanks!!

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [May 31, 2021, 12:02pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/2 "2021-05-31T12:02:37Z")

</div>

Hey @Jose_Manuel_Tirado, the `delete_by_query` doesn't work for you? Something like:

```auto
POST discuss/_delete_by_query
{
"query": {
"range" : {
"timestamp" : {
"gte" : "18/01/2020",
"lte" : "20/02/2020",
"format": "dd/MM/yyyy"
}
}
}
}

```

---

<div class="post-metadata">

**Author:** ![Jose\_Manuel\_Tirado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_manuel_tirado/32/84882_2.png) [@Jose\_Manuel\_Tirado](https://discuss.elastic.co/u/Jose_Manuel_Tirado)\
**Post date:** [May 31, 2021, 12:20pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/3 "2021-05-31T12:20:23Z")

</div>

Sorry I don´t show the command

I launch this

![image](https://us1.discourse-cdn.com/elastic/original/3X/1/5/15f4ec873858514b55ad47d10889df84420ad4c7.png)  
And I obtain the error

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [May 31, 2021, 12:31pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/4 "2021-05-31T12:31:53Z")

</div>

I see, this is an ES error so maybe it would be better to address it there but maybe it works if you also add `?conflicts=proceed&refresh=wait_for`. Do you want to also try this?

The problem is that you have conflicted versions in your index.

---

<div class="post-metadata">

**Author:** ![Jose\_Manuel\_Tirado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_manuel_tirado/32/84882_2.png) [@Jose\_Manuel\_Tirado](https://discuss.elastic.co/u/Jose_Manuel_Tirado)\
**Post date:** [May 31, 2021, 12:52pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/5 "2021-05-31T12:52:53Z")

</div>

Hi again!  
When I launch this

![image](https://us1.discourse-cdn.com/elastic/original/3X/0/b/0b4068c2602788d163d3f2f2609820bcb46a067b.png)

I obtain this

![image](https://us1.discourse-cdn.com/elastic/original/3X/8/6/86b94ec1ba73d15d7f14b1ec557289b61a97016b.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [May 31, 2021, 12:56pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/6 "2021-05-31T12:56:09Z")

</div>

I think this is normal if your index has a substantial size. Can you check if they are deleted, even though you get this error?

---

<div class="post-metadata">

**Author:** ![Jose\_Manuel\_Tirado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_manuel_tirado/32/84882_2.png) [@Jose\_Manuel\_Tirado](https://discuss.elastic.co/u/Jose_Manuel_Tirado)\
**Post date:** [May 31, 2021, 2:15pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/7 "2021-05-31T14:15:37Z")

</div>

Hi!!

Now, I launch this

![image](https://us1.discourse-cdn.com/elastic/original/3X/8/8/88aaf1cf89cab1b931b73267730c030919db37e6.png)  
And obtain this:

![image](https://us1.discourse-cdn.com/elastic/original/3X/6/c/6c3d94b283a5fc10a6707611b27070be6c7b8dde.png)

And don´t delete nothing!

Why?

Thanks

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [May 31, 2021, 2:19pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/8 "2021-05-31T14:19:17Z")

</div>

The field that contains the timefield is `@timestamp` or `nuanceTimestamp` ?

---

<div class="post-metadata">

**Author:** ![Jose\_Manuel\_Tirado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_manuel_tirado/32/84882_2.png) [@Jose\_Manuel\_Tirado](https://discuss.elastic.co/u/Jose_Manuel_Tirado)\
**Post date:** [May 31, 2021, 2:31pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/9 "2021-05-31T14:31:19Z")

</div>

Sorry!! Silly mistake on my part

When I launch

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/1/418fc21a1f2582d2bcd071b9a1e4bfeeda596578.png)

Delete what we wanted! And only we have data of the remaining days

![image](https://us1.discourse-cdn.com/elastic/original/3X/d/8/d82acfe3db14e7a9feee604fe4b20faf9ba7385d.png)

Thanks very much!!

Best regards!!

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [May 31, 2021, 2:33pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/10 "2021-05-31T14:33:29Z")

</div>

Nice, I am really happy that we solved it!

---

<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:** [June 28, 2021, 2:33pm UTC](https://discuss.elastic.co/t/delete-docs-by-date/274493/11 "2021-06-28T14:33:53Z")

</div>

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