Hello,
How do you use an error handler with Hibernate search 6.
I don’t find for the moment in the alpha-8 documentation or in the sample code (the ErrorHandler is moved to the legacy section)
I tried to add the property
“hibernate.search.backends.[myBackend].error_handler”
and
“hibernate.search.error_handler”
I set my property to a full qualified class name “my.package.IndexUpdateErrorHandler”
The class is declared as “public class IndexUpdateErrorHandler implements ErrorHandler”
but I never reach the code in “handle” neither “handleException”.
I tried with some basic errors such as
my database not reachable
my elasticsearch not reachable
a field not acceptable in elasticsearch (example a @GenericField > 32kb)
I see on all cases a lot of exception log but I cannot manage my errors with the handler.
Thank you for your fast answer.
We’d like to use a batch program to reindex all data using the mass indexer.
We’d like to manage errors during indexing process to monitor and adapt our process (maybe retry several times and alert).
We’d like to have an error status at the end of the mass indexer.
We don’t know exactly the error we are looking for, but on the 3 identified cases below, the only hint we have error is reading the log
my database not reachable
my elasticsearch not reachable
a field not acceptable in elasticsearch (example a @GenericField > 32kb)
If I understand correctly, your main problem is that the mass indexer does not terminate with a useful exception when something goes wrong?
If we were to change the mass indexer so that the call to startAndWait() throws the original exception (or another exception with the proper cause), plus some context to identify the entity that caused the problem, would that work for you? Or would you still need an error handler?
It will happen in beta release, but I can’t give you a time frame for now. You can follow HSEARCH-3110 for updates. If you want to contribute and have the time for that, we can discuss it on that ticket.
By the way , when you said “it would be more adapted to our use case”, did you mean:
Changing the mass indexer so that the call to startAndWait() throws the original exception (or another exception with the proper cause), plus some context to identify the entity that caused the problem
In fact, both solution is adapted to our use case.
Actually, I don’t have the time to contribute efficiently to the project, I tried to debug and implement an exception solution but I didn’t manage to understand how to manage the multithreaded indexor with a correct error management
@Alexis_Cucumel We’ve been caught up in solving the remaining problems before Beta1, so unfortunately we haven’t had time to restore the error handlers yet.
I’m releasing Beta1 today and will have a look into a clean replacement for error handlers this week.
This will allow you to set a custom error handler similar to Search 5 by setting the property hibernate.search.error_handler to the fully-qualified class name of your implementation of org.hibernate.search.engine.common.spi.ErrorHandler. The approach is not perfect, and we will change it in the next few versions, but it may allow you to design a solution to whatever problem you’re having?