When deleting by query api all my documents get deleted

(Martin Rioux) #1

Hi, I performed the same operation for 6 months to delete document older than 6 months with the delete by query api.

"query": {
"range": {
"created": {
"lte": "now-150d/d"

I don't know why but today all my documents get deleted with this request. I have a staging server with the same data and everything is OK. I don<t know if there is a safer way to delete data. I run that request every 10 minutes and it delete about 200 documents each time. But today this request delete over 1Million documents.

(David Pilato) #2

It often happens in such case that the user sent a bad request where the body is totally ignored so the query is "match_all"...

Can you see in your history exactly what you did?

Best thing to do is to use time based indices. It's much more efficient IMO.

(Martin Rioux) #3

Thanks for your answer. This request is called in a cronjob and never done manually. I can't use time base indices because some documents will live forever in ES. (new developments ). I just one to find a more secure way to delete documents.

(system) #4

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