apache/seatunnel · error · ElasticsearchConnectorException
CREATE_PIT_FAILED
CREATE_PIT_FAILED
Error message
POST /%s/_pit?keep_alive=%dms response null
What it means
createPointInTime opens a point-in-time (PIT) context (POST /{index}/_pit?keep_alive=<n>ms) used for consistent deep paging; if performRequest returns null it throws CREATE_PIT_FAILED. Without a PIT id the connector cannot perform consistent scroll/slice reads, so the read fails fast.
Source
Thrown at seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java:930
"Failed to add field %s to index %s", fieldTypeDefine.getName(), index),
ex);
}
}
/**
* Creates a Point-in-Time (PIT) for the specified index.
*
* @param index The index to create a PIT for
* @param keepAlive The time to keep the PIT alive (in milliseconds)
* @return The PIT ID
*/
public String createPointInTime(String index, long keepAlive) {
String endpoint = String.format("/%s/_pit?keep_alive=%dms", index.toLowerCase(), keepAlive);
Request request = new Request("POST", endpoint);
try {
Response response = restClient.performRequest(request);
if (response == null) {
throw new ElasticsearchConnectorException(
ElasticsearchConnectorErrorCode.CREATE_PIT_FAILED,
"POST " + endpoint + " response null");
}
String entity = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
JsonNode jsonNode = JsonUtils.parseObject(entity);
return jsonNode.get("id").asText();
} else {
throw new ElasticsearchConnectorException(
ElasticsearchConnectorErrorCode.CREATE_PIT_FAILED,
String.format(
"POST %s response status code=%d, body=%s",
endpoint, response.getStatusLine().getStatusCode(), entity));
}
} catch (IOException ex) {
throw new ElasticsearchConnectorException(
ElasticsearchConnectorErrorCode.CREATE_PIT_FAILED, ex);
}View on GitHub (pinned to cf67b549a7)
Solutions
- Confirm the ES cluster is 7.10+ (PIT API requires it); for older clusters use search_after with sort or scroll instead
- curl -XPOST 'es:9200/{index}/_pit?keep_alive=1m' directly to see the real behavior
- Remove any proxy/CDN interference or custom client wrapper that can return null
- Retry the job — transient nulls typically disappear on a healthy cluster
Example fix
// before: ES 7.9 cluster -> _pit unsupported POST /idx/_pit?keep_alive=60000ms -> null/unsupported // after: upgrade Elasticsearch to >= 7.10, or configure the connector to read without PIT (batch/scroll mode)
Defensive patterns
Strategy: retry
Validate before calling
// confirm PIT support and index presence
curl -s -o /dev/null -w '%{http_code}' -XPOST 'es:9200/<index>/_pit?keep_alive=1m'
# requires Elasticsearch >= 7.10 Type guard
if (response == null) { throw new IOException("null PIT response for " + index); } Try / catch
try {
String pitId = esRestClient.createPointInTime(index, keepAlive);
} catch (ElasticsearchConnectorException e) {
// retry once with backoff; verify cluster supports _pit
} Prevention
- Use Elasticsearch 7.10+ when the connector relies on PIT paging
- Route _pit requests directly to ES nodes, not through CDNs/edge proxies
- Keep keep_alive long enough for the whole read window
- Health-check the cluster before long-running consistent reads
When it happens
Trigger: POST /{index}/_pit?keep_alive=... returning null Response from performRequest instead of a Response or IOException.
Common situations: Custom/mock RestClient returning null; gateway/CDN in front of ES that does not route the _pit endpoint properly; transient connection drop surfaced as null in a wrapped client; very old ES versions (<7.10) where _pit is unsupported and a proxy answers oddly.
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
- DELETE_PIT_FAILED
- SEARCH_WITH_PIT_FAILED
- BULK_RESPONSE_ERROR
- SCROLL_REQUEST_ERROR
- GET_INDEX_DOCS_COUNT_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/9fd8c31dfc82d4ec.
Report an issue: GitHub.