https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43569 --- Comment #5 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 206533 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206533&action=edit Bug 43569: Make update_index report per-document failures This patch makes Koha::SearchEngine::Elasticsearch::Indexer::update_index return a Koha::Result::Boolean instead of the raw Elasticsearch response, so callers can tell when individual documents failed to index even though the bulk request itself succeeded. The result is true when every document indexed successfully (or when there was nothing to index). It is false when the bulk request completed (HTTP 200) but one or more individual documents failed to index; in that case one Koha::Object::Message of type 'error' is recorded per failed document, with the failing record_id and the raw Elasticsearch error in the payload. Changes: - update_index() returns a Koha::Result::Boolean carrying per-document error messages instead of the raw Elasticsearch response - Whole-operation failures (e.g. Elasticsearch unreachable) keep throwing Koha::Exceptions::Elasticsearch::BadResponse, preserving the NoNodes recovery path from bug 42669. An exception means 'could not run'; a false result means 'ran, but some documents failed' - misc/workers/es_indexer_daemon.pl now inspects the returned Boolean: on a partial failure it logs each failing record and marks the batch 'failed' instead of 'finished', so affected records are no longer silently reported as indexed Test plan: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t => SUCCESS: All subtests pass, including the new 'update_index() return value tests' covering partial failure, full success, empty body and the thrown BadResponse exception 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.