Auto invalidation and triggering external function

I'm new in Elasticsearch, and I was wondering if Elasticsearch has some way to invalidate it's data and then call an external function/url (an API endpoint which refresh the data)?
So, in the end my main doubt is about if Elasticsearch can trigger something someway.

I'm not 100% sure I understand you, but it sounds like you want to be able to have Elasticsearch reach out to a different endpoint when documents are deleted?

If so, there's no way to have Elasticsearch tell a different system that documents have been deleted. It sounds like something like the Changes API - might be useful when added.