Zorobay
Zorobay

Reputation: 649

Elasticsearch for python - Get documents deleted by query

I'm using Elasticsearch in python, and I can't figure out how to get the ids of the documents deleted by the delete_by_query() method! By default it only the number of documents deleted.

There is a parameter called _source that if set to True should return the source of the deleted documents. This doesn't happen, nothing changes.

Is there a good way to know which document where deleted?

Upvotes: 0

Views: 50

Answers (1)

Val
Val

Reputation: 217274

The delete by query endpoint only returns a macro summary of what happened during the task, mainly how many documents were deleted and some other details.

If you want to know the IDs of the document that are going to be deleted, you can do a search (with _source: false) before running the delete by query operation and you'll get the expected IDs.

Upvotes: 1

Related Questions