fix(status): handle Serverless Elasticsearch in elastic status#398
Open
MattDevy wants to merge 1 commit into
Open
fix(status): handle Serverless Elasticsearch in elastic status#398MattDevy wants to merge 1 commit into
elastic status#398MattDevy wants to merge 1 commit into
Conversation
Serverless projects remove cluster-level APIs, so `GET /_cluster/health` returns 410 Gone. The status probe surfaced this as `request failed (410)` and marked Elasticsearch as down, even though the project was healthy. On a 410 from `_cluster/health`, fall back to `GET /` (served on Serverless) and report the build version. Stateful clusters keep their single-request path and existing `green (3 nodes)` output unchanged. EsCheckOk is now a discriminated union (stateful | serverless); the formatter renders Serverless as `serverless (<version>)`.
Contributor
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts MegaLinter is graciously provided by OX Security |
JoshMock
approved these changes
Jun 3, 2026
| ): Promise<EsCheck> { | ||
| const result = await pingService(block.url, '/_cluster/health', block.auth, fetchFn) | ||
| if (!result.ok) return { ok: false, url: block.url, error: result.error } | ||
| if (!result.ok) { |
Member
There was a problem hiding this comment.
My only suggestion: if we have any hints that a cluster might be serverless (its hostname, perhaps, or if the commandProfile is set to serverless), we should run the serverless check first to reduce the chances of sending a request that's doomed to fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
elastic statusreports Elasticsearch as down on Serverless projects, even when the project is healthy:Root cause
The Elasticsearch probe calls
GET /_cluster/health(src/status/checks.ts). Serverless removes cluster-level APIs and answers that endpoint with 410 Gone, which the generic HTTP classifier turned intorequest failed (410). Kibana's/api/statusexists on Serverless, so it already showed✓.Confirmed against a live Serverless project:
GET /version.number,build_flavor: serverless)GET /_cluster/healthGET /_security/_authenticateFix
pingServicenow surfaces the HTTP status code on failure.checkElasticsearchkeeps the single/_cluster/healthrequest for stateful clusters. On a 410 specifically, it falls back toGET /(served on Serverless) and readsversion.number.EsCheckOkbecomes a discriminated union:EsCheckStateful { flavor, status, nodes }|EsCheckServerless { flavor, version }.serverless (<version>); stateful output is unchanged.Only a 410 triggers the fallback. Other failures (401, 503, network) are still reported as failures, and stateful clusters are completely unaffected.
Result
Exit code is now
0.Test plan
tsc -bcleantest/status/*.test.ts)version.number→unexpected response, root failure propagation (401), serverless rendering