feat(indexing): process ES client indexing errors (WIP)#267
Conversation
|
I like the logging option the most, but I don't think we need an extra config option for it. You may just log it as soon as logging is enabled! |
|
@Jeroen-G you're right, we can use the existing logging option. Do you have any thought about the log format, or should we keep it simple for now, and enhance it when people come with actual use cases for enhancements? I'll work on this later today or this weekend. Thanks ! |
|
It should work with the logger that you can configure, which is a PSR3 LoggerInterface. |
|
Any update on this @superbiche? The lack of error visibility caused me some grief, and I'd like to have confidence that all of my elasticsearch indices are fully in sync with my database. UPDATE - I also made a PR - #273 |
This is a first shot at handling indexing error in
ElasticEngine::update($models).Related to #221 (we are struggling with indexing errors too).
For now, I'm just retrieving ES client errors, then build a Collection of error strings, recursively inserting each "caused_by" until we get to the root cause.
I'm not sure about what the next steps should be, but I have some ideas:
Add an option in
config/explorer.phpto log these errors, eg:Throw a
ModelBulkUpdateFailedException, which could format properly the error message, along with the Model class and Index name.Throwing this should also be toggled in a configuration option, because the whole
MakeSearchablewill fail if we throw, even if some models were actually indexed. I'm not a fan of this option but at least it's very strict.Fire an event (
ModelBulkUpdateFailedEvent?) that can be handled in userland, so we leave the actual behavior to the developer (to log, throw, use Sentry or something similar, send an alert...)I like the logging approach, as it's really easy to implement, but I also think the event approach can enable more specific workflows. So I'd suggest we go with both.
I'm open for any suggestion regarding how the message is formatted, and which approach could be acceptable (if we go with the event approach, we should supplement the error messages with event properties to get the raw data.
What do you think?
Cheers,
Michel