Soft Delete Indexed Entites

Hello guys,

i was wondering how to handle the soft deletable entities with the indexation for ElasticSearch.
i would like the index to be remove from elastic cluster when the entity is updated and maybe if a predicated is verified.

do you have any ideas?

see ya


This was formerly achieved in Hibernate Search 5 through indexing interceptors, which are yet to be restored in Search 6 (HSEARCH-3108).

In the meantime, the only solution I see is to index a “soft-deletion” marker, and to explicitly filter all your search queries to ignore the entities that are “soft-deleted”.

1 Like

Thanks @yrodiere, i will go for the “marker” option :slight_smile:


FYI I just sent a pull request to implement something equivalent to indexing interceptors:

It will be available in the next release (Beta or Candidate Release) of Hibernate Search 6.

EDIT: Fixed the link, it was wrong.

Hello @yrodiere, thank you for the information !