# How delete\_by\_query works internally?

**URL:** https://discuss.elastic.co/t/how-delete-by-query-works-internally/177460
**Category:** Elasticsearch
**Created:** [April 18, 2019, 12:24pm UTC](https://discuss.elastic.co/t/how-delete-by-query-works-internally/177460 "2019-04-18T12:24:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sushama](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sushama/32/58623_2.png) [@sushama](https://discuss.elastic.co/u/sushama)
#### Post date: [April 18, 2019, 12:24pm UTC](https://discuss.elastic.co/t/how-delete-by-query-works-internally/177460/1 "2019-04-18T12:24:35Z")

</div>

Hi,  
I am using delete\_by\_query plugin to delete the documents based on date range criteria, ES version is 2.3.

When I run the query using java API I get the response of type DeleteByQueryResponse holding some fields like TookInMillis, TotalDeleted, TotalMissing etc.

In my case program run for 1704369 ms (calculated by start and end of the program)

and response from Es is TookInMillis: 12340444|TotalDeleted: 38997403|TotalFound: 38997482|TotalMissing: 0|TotalFailed: 79

Here I see huge difference between the timings. How its been calculated by ES ? How I can make it synchronous?

---

<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: [May 16, 2019, 12:24pm UTC](https://discuss.elastic.co/t/how-delete-by-query-works-internally/177460/2 "2019-05-16T12:24:40Z")

</div>

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