{"record":{"id":"43685df21dc72612","repo":"apache/seatunnel","slug":"bulk-response-error-43685d","errorCode":"BULK_RESPONSE_ERROR","errorMessage":"bulk ezs error: ","messagePattern":"bulk ezs error: ","errorType":"error_code","errorClass":"EasysearchConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/sink/EasysearchSinkWriter.java","lineNumber":111,"sourceCode":"    @Override\n    public Optional<EasysearchCommitInfo> prepareCommit() {\n        bulkEzsWithRetry(this.ezsClient, this.requestEzsList);\n        return Optional.empty();\n    }\n\n    @Override\n    public void abortPrepare() {}\n\n    public synchronized void bulkEzsWithRetry(\n            EasysearchClient ezsClient, List<String> requestEzsList) {\n        try {\n            RetryUtils.retryWithException(\n                    () -> {\n                        if (!requestEzsList.isEmpty()) {\n                            String requestBody = String.join(\"\\n\", requestEzsList) + \"\\n\";\n                            BulkResponse bulkResponse = ezsClient.bulk(requestBody);\n                            if (bulkResponse.isErrors()) {\n                                throw new EasysearchConnectorException(\n                                        EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR,\n                                        \"bulk ezs error: \" + bulkResponse.getResponse());\n                            }\n                            return bulkResponse;\n                        }\n                        return null;\n                    },\n                    retryMaterial);\n            requestEzsList.clear();\n        } catch (Exception e) {\n            throw new EasysearchConnectorException(\n                    SQL_OPERATION_FAILED, \"Easysearch execute batch statement error\", e);\n        }\n    }\n\n    @Override\n    public void close() throws IOException {\n        bulkEzsWithRetry(this.ezsClient, this.requestEzsList);","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/sink/EasysearchSinkWriter.java#L93-L129","documentation":"EasysearchSinkWriter.bulkEzsWithRetry sends accumulated bulk request lines to the Easysearch cluster via ezsClient.bulk(). If the BulkResponse reports errors (isErrors() true — some individual items in the bulk failed), it throws a BULK_RESPONSE_ERROR containing the raw response body. This is the server acknowledging the request but rejecting one or more operations.","triggerScenarios":"A bulk API call returns HTTP 200 with per-item errors: document mapping conflicts (wrong type for an existing field), index not found, document too large, cluster read-only/disk watermark exceeded, or version conflicts on updates.","commonSituations":"Sink schema doesn't match the target index mapping; target index closed or missing; disk flood-stage watermark set cluster to read-only; bulk payload contains a document that violates dynamic mapping.","solutions":["Read the response body in the error message to identify which items failed and why (usually a mapper_parsing_exception or index_not_found).","Fix the mapping mismatch: correct the field types in the schema, or recreate/reindex the target index.","Ensure the target index exists and is open; unblock the cluster if it hit disk watermarks (free space, raise flood_stage threshold).","Enable per-batch retry/dead-letter handling for transient item failures in the writer config."],"exampleFix":"// before: schema writes age as STRING into index where age is mapped INTEGER -> item error\n// after: align schema with index mapping\n{\"age\": {\"type\": \"INT\"}}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { writer.write(row); } catch (EasysearchConnectorException e) { if (e.getSeaTunnelErrorCode() == EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR) { String body = e.getMessage(); log.error(\"Bulk item failures, inspect response: {}\", body); /* route failed docs to DLQ and re-submit */ } else { throw e; } }","preventionTips":["Align sink schema with the index mapping before the job runs","Verify the target index exists, is open, and cluster disk watermarks are not breached","Test a small bulk payload with curl _bulk first"],"tags":["easysearch","bulk","http-error-response"],"backgroundTag":"http-error-response","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}