Skip to content

Commit f0e6f7e

Browse files
[VD-7482] Some insertions may fail, deal with it
1 parent 6d368bf commit f0e6f7e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

target_elasticsearch/sinks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,11 @@ def insert_individual_records(recs):
461461
# Successful -> exit the loop
462462
break
463463
except elasticsearch.helpers.BulkIndexError as e:
464+
# VD-7482: this is something we may accept, e.g the document is way too big - just don't crash.
464465
self.logger.error(f"BulkIndexError on attempt {attempt + 1}: {e.errors}")
465-
raise # Re-raise the BulkIndexError as it's not a connection issue
466+
failed_records = insert_individual_records(records)
467+
if failed_records:
468+
self.logger.error(f"Failed to insert {len(failed_records)} records even in individual mode (bulk error). Ignore error")
466469
except elasticsearch.exceptions.ConnectionTimeout as e:
467470
if attempt < MAX_RETRIES - 1:
468471
self.logger.warning(f"ConnectionTimeout on attempt {attempt + 1}. Retrying in {RETRY_DELAY} seconds...")

0 commit comments

Comments
 (0)