{"record":{"id":"ec21e29d638f05e8","repo":"apache/seatunnel","slug":"get-es-version-failed","errorCode":"GET_ES_VERSION_FAILED","errorMessage":"fail to get elasticsearch version.","messagePattern":"fail to get elasticsearch version\\.","errorType":"error_code","errorClass":"ElasticsearchConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java","lineNumber":173,"sourceCode":"        }\n    }\n\n    public ElasticsearchClusterInfo getClusterInfo() {\n        Request request = new Request(\"GET\", \"/\");\n        try {\n            Response response = restClient.performRequest(request);\n            String result = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);\n            JsonNode jsonNode = OBJECT_MAPPER.readTree(result);\n            JsonNode versionNode = jsonNode.get(\"version\");\n            return ElasticsearchClusterInfo.builder()\n                    .clusterVersion(versionNode.get(\"number\").asText())\n                    .distribution(\n                            Optional.ofNullable(versionNode.get(\"distribution\"))\n                                    .map(JsonNode::asText)\n                                    .orElse(null))\n                    .build();\n        } catch (IOException e) {\n            throw new ElasticsearchConnectorException(\n                    ElasticsearchConnectorErrorCode.GET_ES_VERSION_FAILED,\n                    \"fail to get elasticsearch version.\",\n                    e);\n        }\n    }\n\n    @Override\n    public void close() {\n        try {\n            restClient.close();\n        } catch (IOException e) {\n            log.warn(\"close elasticsearch connection error\", e);\n        }\n    }\n\n    /**\n     * first time to request search documents by scroll call /${index}/_search?scroll=${scroll}\n     *","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java#L155-L191","documentation":"EsRestClient.getClusterInfo queries the cluster info endpoint to determine the Elasticsearch version and distribution. If the HTTP exchange throws IOException, it rethrows as ElasticsearchConnectorException with code GET_ES_VERSION_FAILED and this message. It fires at client/catalog initialization, so it usually blocks any subsequent operation.","triggerScenarios":"IOException while GET-ing cluster info during getClusterInfo — called during client initialization, connection tests, and several test paths: ES unreachable, auth failure handled as IO, TLS errors, connection timeouts.","commonSituations":"Wrong address or port in ES config; Elasticsearch down or upgrading; TLS certificate issues; security plugin returning 401 surfaced through an IOException wrapper; firewall blocking the port.","solutions":["Check the chained IOException for the exact transport failure","Verify host/port/credentials with curl: curl http://es-host:9200/","If using HTTPS, ensure the scheme and truststore/certificate are configured correctly","Confirm the Elasticsearch cluster is running and reachable from the SeaTunnel node","Retry initialization after transient network/cluster recovery"],"exampleFix":"// before\nElasticSearchCatalog catalog = new ElasticSearchCatalog(\"es\", options); // throws GET_ES_VERSION_FAILED\n// after\ntry {\n    catalog = new ElasticSearchCatalog(\"es\", options);\n} catch (CatalogException e) {\n    LOG.error(\"Cannot reach Elasticsearch, check host/port/credentials\", e);\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"// Before creating the client: curl-equivalent check\n// new HttpGet(\"http://es-host:9200/\") returns 200 with version JSON","typeGuard":null,"tryCatchPattern":"try { catalog = new ElasticSearchCatalog(\"es\", options); } catch (Exception e) { if (message contains \"fail to get elasticsearch version\") { LOG.error(\"ES unreachable: check host/port/TLS\", e); } throw e; }","preventionTips":["Validate ES host/port/credentials during deployment config checks","Use HTTPS with a proper truststore when the cluster is TLS-enabled","Ensure network/firewall allows the SeaTunnel node to reach port 9200","Retry client creation on transient network failures"],"tags":["elasticsearch","version-detection","cluster-info","network"],"backgroundTag":"api-request-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}