apache/seatunnel · error · ElasticsearchConnectorException

LIST_INDEX_FAILED

LIST_INDEX_FAILED

Error message

GET {endpoint} response null

What it means

Thrown by EsRestClient.listIndex when the GET /_cat/indices?format=json request returns a null Response. The library uses this call to enumerate all indices; a null response makes listing impossible, so it raises LIST_INDEX_FAILED.

Source

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

                throw new ElasticsearchConnectorException(
                        ElasticsearchConnectorErrorCode.GET_INDEX_DOCS_COUNT_FAILED,
                        String.format(
                                "GET %s response status code=%d, body=%s",
                                endpoint, response.getStatusLine().getStatusCode(), entity));
            }
        } catch (IOException ex) {
            throw new ElasticsearchConnectorException(
                    ElasticsearchConnectorErrorCode.GET_INDEX_DOCS_COUNT_FAILED, ex);
        }
    }

    public List<String> listIndex() {
        String endpoint = "/_cat/indices?format=json";
        Request request = new Request("GET", endpoint);
        try {
            Response response = restClient.performRequest(request);
            if (response == null) {
                throw new ElasticsearchConnectorException(
                        ElasticsearchConnectorErrorCode.LIST_INDEX_FAILED,
                        "GET " + endpoint + " response null");
            }
            String entity = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                return JsonUtils.toList(entity, Map.class).stream()
                        .map(map -> map.get("index").toString())
                        .collect(Collectors.toList());
            } else {
                throw new ElasticsearchConnectorException(
                        ElasticsearchConnectorErrorCode.LIST_INDEX_FAILED,
                        String.format(
                                "GET %s response status code=%d, body=%s",
                                endpoint, response.getStatusLine().getStatusCode(), entity));
            }
        } catch (IOException ex) {
            throw new ElasticsearchConnectorException(
                    ElasticsearchConnectorErrorCode.LIST_INDEX_FAILED, ex);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Use the standard Elasticsearch Low Level REST Client construction path in the connector config
  2. Check proxy/interceptor settings that could swallow the response
  3. Enable wire-level logging (trace) on the REST client to confirm request/response behavior
  4. Align connector dependency versions with the deployed Elasticsearch client jars
Defensive patterns

Strategy: try-catch

Type guard

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

Try / catch

try {
    List<String> indices = client.listIndex();
} catch (ElasticsearchConnectorException e) {
    if (e.getMessage().contains("response null")) {
        // fall back to an explicitly configured index list instead of discovery
    }
    throw e;
}

Prevention

When it happens

Trigger: listIndex() invocation where restClient.performRequest returns null for the _cat/indices request.

Common situations: Non-standard/proxied RestClient returning null; client library version mismatch between the connector and the shaded ES REST client.

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/e29ed3c085e96d99. Report an issue: GitHub.