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."""