# Delete by Query - Is there a way to get the ids of the deleted documents?

**URL:** <https://discuss.elastic.co/t/delete-by-query-is-there-a-way-to-get-the-ids-of-the-deleted-documents/127385>\
**Category:** Elasticsearch\
**Created:** [April 9, 2018, 8:47pm UTC](https://discuss.elastic.co/t/delete-by-query-is-there-a-way-to-get-the-ids-of-the-deleted-documents/127385 "2018-04-09T20:47:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hk4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hk4/32/29426_2.png) [@hk4](https://discuss.elastic.co/u/hk4)\
**Post date:** [April 9, 2018, 8:47pm UTC](https://discuss.elastic.co/t/delete-by-query-is-there-a-way-to-get-the-ids-of-the-deleted-documents/127385/1 "2018-04-09T20:47:30Z")

</div>

I am using the Delete by Query API to delete documents from an index. In the response, I can only see the number of documents that have been deleted. How can I get the ids of the documents that were deleted?

Using Elasticsearch 6.2.2.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 9, 2018, 9:02pm UTC](https://discuss.elastic.co/t/delete-by-query-is-there-a-way-to-get-the-ids-of-the-deleted-documents/127385/2 "2018-04-09T21:02:00Z")

</div>

I don't think you can.

But you can manually reproduce what elasticsearch is doing behind the scene on the client side.

Do a scroll search and bulk the delete operations.

---

<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 7, 2018, 9:02pm UTC](https://discuss.elastic.co/t/delete-by-query-is-there-a-way-to-get-the-ids-of-the-deleted-documents/127385/3 "2018-05-07T21:02:05Z")

</div>

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