Hello,
Short answer: it’s possible, but clearly not trivial.
That would require to re-implement a small part of Hibernate Search, namely the worker. Fortunately there’s an SPI for that: implement org.hibernate.search.backend.spi.Worker, and tell Hibernate Search to use your implementation by setting hibernate.search.worker.scope to the fully qualified name of your implementation class. See the documentation.
Implementing your own worker may be complex, because the worker is global to Hibernate Search and has to defer the execution of indexing works to the end of a transaction. You could get some inspiration from the default implementation, org.hibernate.search.backend.impl.PerTransactionWorker, but be careful about copying the code since it relies in part on Hibernate Search internals which may change at any moment. In the end, what you would want is the same implementation except PerTransactionWorker#createTransactionWorkQueueSynchronization would return a subclass of org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization that swallows exceptions in PostTransactionWorkQueueSynchronization#beforeCompletion and does not perform the works in PostTransactionWorkQueueSynchronization#afterCompletion if beforeCompletion failed.
Note: SPIs have a weaker guarantee than APIs, we may break them without warning between minor versions of Hibernate Search (between 5.10 and 5.11 for instance). We generally try to keep the same features available, but source code compatibility may be lost.
That being said… It seems reasonable to think others will have the same need as you. I added a ticket about just that: https://hibernate.atlassian.net/browse/HSEARCH-3109 . We will see if we can implement a setting in a future version.