apache/seatunnel · error · EasysearchConnectorException
GET_INDEX_DOCS_COUNT_FAILED
GET_INDEX_DOCS_COUNT_FAILED
Error message
GET ${endpoint} response null What it means
getIndexDocsCount performs GET /_cat/indices/{index}?h=index,docsCount&format=json and throws GET_INDEX_DOCS_COUNT_FAILED when the REST client returns a null Response. As with the scroll path, null is treated as an anomalous transport result and fails fast to prevent NPEs on the status line.
Source
Thrown at seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/client/EasysearchClient.java:443
String fieldName = entry.getKey();
if (entry.getValue() instanceof TextNode) {
doc.put(fieldName, entry.getValue().textValue());
} else {
doc.put(fieldName, entry.getValue());
}
}
docs.add(doc);
}
return scrollResult;
}
public List<IndexDocsCount> getIndexDocsCount(String index) {
String endpoint = String.format("/_cat/indices/%s?h=index,docsCount&format=json", index);
Request request = new Request("GET", endpoint);
try {
Response response = restClient.performRequest(request);
if (response == null) {
throw new EasysearchConnectorException(
EasysearchConnectorErrorCode.GET_INDEX_DOCS_COUNT_FAILED,
"GET " + endpoint + " response null");
}
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String entity = EntityUtils.toString(response.getEntity());
List<IndexDocsCount> indexDocsCounts =
JsonUtils.toList(entity, IndexDocsCount.class);
return indexDocsCounts;
} else {
throw new EasysearchConnectorException(
EasysearchConnectorErrorCode.GET_INDEX_DOCS_COUNT_FAILED,
String.format(
"GET %s response status code=%d",
endpoint, response.getStatusLine().getStatusCode()));
}
} catch (IOException ex) {
throw new EasysearchConnectorException(
EasysearchConnectorErrorCode.GET_INDEX_DOCS_COUNT_FAILED, ex);View on GitHub (pinned to cf67b549a7)
Solutions
- Confirm the index name in config matches an existing index (wildcards allowed in _cat/indices)
- Check proxies/LBs between SeaTunnel and the cluster for null-response behavior
- Re-run the job; a transient transport glitch usually won't repeat
- Capture REST client wire logs to see what preceded the null response
Example fix
// before
if (response == null) { throw ... }
// after
if (response == null) { throw new EasysearchConnectorException(GET_INDEX_DOCS_COUNT_FAILED, "GET " + endpoint + " response null"); }
// plus caller-side retry
for (int i = 0; i < 3 && count == null; i++) { try { count = client.getIndexDocsCount(index); } catch (EasysearchConnectorException e) { backoff(); } } Defensive patterns
Strategy: retry
Validate before calling
// check index exists before counting
Response head = restClient.performRequest(new Request("HEAD", "/" + index));
if (head.getStatusLine().getStatusCode() == 404) throw new IllegalStateException("index missing: " + index); Type guard
boolean valid(Response r) { return r != null && r.getStatusLine() != null; } Try / catch
try { count = client.getIndexDocsCount(index); } catch (EasysearchConnectorException e) { count = backoffRetryOrDefault(3, 0L); } Prevention
- Confirm index names (and aliases) exist before job submission
- Retry transient transport failures with exponential backoff
- Keep network path free of flaky proxies
- Log full response context when the anomaly occurs
When it happens
Trigger: Called to fetch document counts for an index (e.g. during source catalog/split planning) and restClient.performRequest returns null.
Common situations: Intermittent load-balancer behavior returning empty responses, client/proxy misconfiguration, or custom interceptor stripping the response.
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
- SCROLL_REQUEST_ERROR
- LIST_INDEX_FAILED
- BULK_RESPONSE_ERROR
- CREATE_INDEX_FAILED
- GET_INDEX_DOCS_COUNT_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/2bee4801d8c82c7f.
Report an issue: GitHub.