# Safeguard / Circuit-breakers to prevent accidental deletion of a large number of documents

**URL:** https://discuss.elastic.co/t/safeguard-circuit-breakers-to-prevent-accidental-deletion-of-a-large-number-of-documents/234431
**Category:** Elasticsearch
**Created:** [May 26, 2020, 11:46pm UTC](https://discuss.elastic.co/t/safeguard-circuit-breakers-to-prevent-accidental-deletion-of-a-large-number-of-documents/234431 "2020-05-26T23:46:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sg.esearch](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@sg.esearch](https://discuss.elastic.co/u/sg.esearch)
#### Post date: [May 26, 2020, 11:46pm UTC](https://discuss.elastic.co/t/safeguard-circuit-breakers-to-prevent-accidental-deletion-of-a-large-number-of-documents/234431/1 "2020-05-26T23:46:35Z")

</div>

We have a couple of clusters where it is extremely hard to re-ingest data again.  
Some of them use nested docs, some don't.  
But all of them want to use DBQ (Delete By Query).

But deletion-by-query is a bit scary feature since it relies absolutely on the query being foolproof.  
If by chance a wrong query is executed, then those documents will get deleted.

Is there a setting to limit the number of documents being deleted in a single DBQ?  
Say something like:

```auto
safeguards.delete.max.percentage = 25
safeguards.delete.max.count = 10000

```

So if a DBQ tries to delete more than 25% of documents or more than 10,000 documents, then ES will raise an exception to the user trying to run the DBQ.

---

<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 23, 2020, 11:46pm UTC](https://discuss.elastic.co/t/safeguard-circuit-breakers-to-prevent-accidental-deletion-of-a-large-number-of-documents/234431/2 "2020-06-23T23:46:39Z")

</div>

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