From 754238a77fe62897c33d71feac78291cd9c19ce7 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 5 Jan 2021 14:42:34 -0800 Subject: worker: check for error responses from ES --- fatcat_scholar/worker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fatcat_scholar/worker.py b/fatcat_scholar/worker.py index d2cc3cb..4c1b9d7 100644 --- a/fatcat_scholar/worker.py +++ b/fatcat_scholar/worker.py @@ -145,9 +145,12 @@ class IndexDocsWorker(KafkaWorker): if not bulk_actions: return - self.es_client.bulk( + resp = self.es_client.bulk( "\n".join(bulk_actions), self.es_index, timeout="30s", ) + if resp.get("errors"): + print(resp["errors"], file=sys.stderr) + raise Exception("elasticsearch index response errors") self.counts["batches-indexed"] += 1 -- cgit v1.2.3