apache/seatunnel · error · EasysearchConnectorException

BULK_RESPONSE_ERROR

BULK_RESPONSE_ERROR

Error message

bulk ezs Response is null

What it means

EasysearchClient.bulk performs a POST /_bulk and treats a null HTTP Response as a protocol-level failure, throwing EasysearchConnectorException with BULK_RESPONSE_ERROR. A null response means the RestClient returned no usable response object for the bulk request.

Source

Thrown at seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/client/EasysearchClient.java:239

                                fieldName -> {
                                    String fieldType = allEasysearchFieldTypeInfoMap.get(fieldName);
                                    if (fieldType == null) {
                                        log.warn(
                                                "fail to get easysearch field {} mapping type,so give a default type text",
                                                fieldName);
                                        return "text";
                                    }
                                    return fieldType;
                                }));
    }

    public BulkResponse bulk(String requestBody) {
        Request request = new Request("POST", "/_bulk");
        request.setJsonEntity(requestBody);
        try {
            Response response = restClient.performRequest(request);
            if (response == null) {
                throw new EasysearchConnectorException(
                        EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR,
                        "bulk ezs Response is null");
            }
            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                ObjectMapper objectMapper = new ObjectMapper();
                String entity = EntityUtils.toString(response.getEntity());
                JsonNode json = objectMapper.readTree(entity);
                int took = json.get("took").asInt();
                boolean errors = json.get("errors").asBoolean();
                return new BulkResponse(errors, took, entity);
            } else {
                throw new EasysearchConnectorException(
                        EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR,
                        String.format(
                                "bulk ezs response status code=%d,request boy=%s",
                                response.getStatusLine().getStatusCode(), requestBody));
            }
        } catch (IOException e) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check network path/proxy between the job and Easysearch; remove any middleware that can return a null Response.
  2. Retry the bulk write; records remain in the writer buffer only if the exception propagates before acknowledgment.
  3. Enable RestClient trace logging to see whether a request was actually sent.
  4. If persistent, upgrade the Easysearch REST client dependency in the connector.

Example fix

// no caller fix; guard at usage site
// before
BulkResponse resp = client.bulk(requestBody);
// after
try {
    BulkResponse resp = client.bulk(requestBody);
} catch (EasysearchConnectorException e) {
    if (EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR.equals(e.getErrorCode())) {
        // retry flush or fail the sink
    }
    throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

// ensure client and endpoint configured before bulk
Objects.requireNonNull(restClient, "RestClient must be initialized before bulk");

Try / catch

try {
    BulkResponse resp = client.bulk(requestBody);
} catch (EasysearchConnectorException e) {
    if (EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR.equals(e.getErrorCode())) {
        // retry flush with backoff
    } else throw e;
}

Prevention

When it happens

Trigger: restClient.performRequest returns null while flushing buffered records through bulkResponse; typically only with misbehaving client/proxy setups or intercepted transport layers.

Common situations: Custom RestClient configurations or proxies swallowing the response; connection closed abnormally without raising IOException; retry middleware returning null on failure.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/7762c53f45bc46a1. Report an issue: GitHub.