From 82f71426b00fa83908407472d65884cb7765f82a Mon Sep 17 00:00:00 2001 From: Joshua Van Deren Date: Fri, 2 Aug 2024 15:56:53 -0600 Subject: [PATCH] Add more logging --- pgsync/search_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pgsync/search_client.py b/pgsync/search_client.py index a84fa1d..27f763e 100644 --- a/pgsync/search_client.py +++ b/pgsync/search_client.py @@ -174,7 +174,7 @@ def _bulk( ): """Bulk index, update, delete docs to Elasticsearch/OpenSearch.""" if settings.ELASTICSEARCH_STREAMING_BULK: - for ok, _ in self.streaming_bulk( + for ok, info in self.streaming_bulk( self.__client, actions, index=index, @@ -189,10 +189,12 @@ def _bulk( ): if ok: self.doc_count += 1 + else: + logger.error(f"Document failed to index: {info}") else: # parallel bulk consumes more memory and is also more likely # to result in 429 errors. - for ok, _ in self.parallel_bulk( + for ok, info in self.parallel_bulk( self.__client, actions, thread_count=thread_count, @@ -206,6 +208,8 @@ def _bulk( ): if ok: self.doc_count += 1 + else: + logger.error(f"Document failed to index: {info}") def refresh(self, indices: t.List[str]) -> None: """Refresh the Elasticsearch/OpenSearch index."""