diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-01-05 14:42:34 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-01-05 15:25:17 -0800 |
commit | 754238a77fe62897c33d71feac78291cd9c19ce7 (patch) | |
tree | b96cdef3e58d0ec0d188903515d7befccf3da1ba | |
parent | dd6be78f5162784519a9ea920a50f45565445693 (diff) | |
download | fatcat-scholar-754238a77fe62897c33d71feac78291cd9c19ce7.tar.gz fatcat-scholar-754238a77fe62897c33d71feac78291cd9c19ce7.zip |
worker: check for error responses from ES
-rw-r--r-- | fatcat_scholar/worker.py | 5 |
1 files changed, 4 insertions, 1 deletions
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 |