apache/seatunnel · error · ElasticsearchConnectorException

CREATE_INDEX_FAILED

CREATE_INDEX_FAILED

Error message

PUT {endpoint} response null

What it means

Thrown when a PUT /{index} request to create an index (optionally with a mapping body) returns a null Response. The library raises CREATE_INDEX_FAILED since it cannot confirm the index creation outcome.

Source

Thrown at seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java:620

            throw new ElasticsearchConnectorException(
                    ElasticsearchConnectorErrorCode.LIST_INDEX_FAILED, ex);
        }
    }

    public void createIndex(String indexName) {
        createIndex(indexName, null);
    }

    public void createIndex(String indexName, String mapping) {
        String endpoint = String.format("/%s", indexName.toLowerCase());
        Request request = new Request("PUT", endpoint);
        if (StringUtils.isNotEmpty(mapping)) {
            request.setJsonEntity(mapping);
        }
        try {
            Response response = restClient.performRequest(request);
            if (response == null) {
                throw new ElasticsearchConnectorException(
                        ElasticsearchConnectorErrorCode.CREATE_INDEX_FAILED,
                        "PUT " + endpoint + " response null");
            }
            String entity = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
            if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
                throw new ElasticsearchConnectorException(
                        ElasticsearchConnectorErrorCode.CREATE_INDEX_FAILED,
                        String.format(
                                "PUT %s response status code=%d, body=%s",
                                endpoint, response.getStatusLine().getStatusCode(), entity));
            }
        } catch (IOException ex) {
            throw new ElasticsearchConnectorException(
                    ElasticsearchConnectorErrorCode.CREATE_INDEX_FAILED, ex);
        }
    }

    public void dropIndex(String tableName) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Confirm the standard ES Low Level REST Client is used and correctly configured (hosts, auth, scheme)
  2. Check intermediary proxies/LBs for dropped or intercepted PUT requests
  3. Trace the REST client at wire level to see whether Elasticsearch actually answered
  4. Verify the cluster is reachable and the response path is not mangled by security plugins
Defensive patterns

Strategy: try-catch

Type guard

boolean hasResponse(Response r) { return r != null; }

Try / catch

try {
    client.createIndex(indexName, mapping);
} catch (ElasticsearchConnectorException e) {
    if (e.getMessage().contains("response null")) {
        // verify creation with GET /{index} before proceeding
        if (client.indexExists(indexName)) return; // created despite null response
    }
    throw e;
}

Prevention

When it happens

Trigger: createIndex call where restClient.performRequest returns null for the PUT index request.

Common situations: Wrapped/custom RestClient implementations; proxy or load-balancer anomalies silently dropping responses.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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