How to monitor deleted document information

hello . I need everyone's help.
Currently, I want to perform document monitoring on the ES server. I can accomplish this by using the _seq_no attribute to monitor the addition and modification of documents. However, when it comes to document deletions, what API or method should I use to monitor and obtain the ID of the deleted document

Hi @double-7 !

There is no API that provides the IDs of deleted documents. Elasticsearch is based on Lucene, and Lucene does not track the IDs of deleted docs in a way they can be related to Elasticsearch document IDs.

You can use some alternatives, that will require changes at your application level:

  • Use soft deletes. Instead of deleting docs, you could add a is_deleted field to the docs that is set to true when docs are deleted, and use it as a filter on your queries.
  • Maintain a separate index of deleted doc IDs, updated when docs are deleted.

I hope that helps!

This is very helpful. Thank you