Skip to content

Commit f66ca2d

Browse files
authored
Introduce new node feature for renaming health endpoint (#107154)
The health API was available for experimentation under the [`_internal/_health`](https://www.elastic.co/guide/en/elasticsearch/reference/8.6/health-api.html) before it [became GA](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/health-api.html) at `8.7.0`. For this reason we introduce another node feature to capture this change. Fixes #106933
1 parent 29888ff commit f66ca2d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/HealthNodeUpgradeIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.carrotsearch.randomizedtesting.annotations.Name;
1212

1313
import org.apache.http.util.EntityUtils;
14-
import org.apache.lucene.tests.util.LuceneTestCase.AwaitsFix;
1514
import org.elasticsearch.client.Request;
1615
import org.elasticsearch.client.Response;
1716
import org.hamcrest.Matchers;
@@ -21,7 +20,6 @@
2120

2221
import static org.hamcrest.CoreMatchers.equalTo;
2322

24-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/106933")
2523
public class HealthNodeUpgradeIT extends ParameterizedRollingUpgradeTestCase {
2624

2725
public HealthNodeUpgradeIT(@Name("upgradedNodes") int upgradedNodes) {
@@ -36,7 +34,8 @@ public void testHealthNode() throws Exception {
3634
assertThat(tasks, Matchers.containsString("health-node"));
3735
});
3836
assertBusy(() -> {
39-
Response response = client().performRequest(new Request("GET", "_health_report"));
37+
String path = clusterHasFeature("health.supports_health_report_api") ? "_health_report" : "_internal/_health";
38+
Response response = client().performRequest(new Request("GET", path));
4039
Map<String, Object> health_report = entityAsMap(response.getEntity());
4140
assertThat(health_report.get("status"), equalTo("green"));
4241
});

server/src/main/java/org/elasticsearch/health/HealthFeatures.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
public class HealthFeatures implements FeatureSpecification {
1919

2020
public static final NodeFeature SUPPORTS_HEALTH = new NodeFeature("health.supports_health");
21+
public static final NodeFeature SUPPORTS_HEALTH_REPORT_API = new NodeFeature("health.supports_health_report_api");
2122
public static final NodeFeature SUPPORTS_SHARDS_CAPACITY_INDICATOR = new NodeFeature("health.shards_capacity_indicator");
2223
public static final NodeFeature SUPPORTS_EXTENDED_REPOSITORY_INDICATOR = new NodeFeature("health.extended_repository_indicator");
2324

@@ -28,6 +29,13 @@ public Set<NodeFeature> getFeatures() {
2829

2930
@Override
3031
public Map<NodeFeature, Version> getHistoricalFeatures() {
31-
return Map.of(SUPPORTS_HEALTH, Version.V_8_5_0, SUPPORTS_SHARDS_CAPACITY_INDICATOR, Version.V_8_8_0);
32+
return Map.of(
33+
SUPPORTS_HEALTH,
34+
Version.V_8_5_0, // health accessible via /_internal/_health
35+
SUPPORTS_HEALTH_REPORT_API,
36+
Version.V_8_7_0, // health accessible via /_health_report
37+
SUPPORTS_SHARDS_CAPACITY_INDICATOR,
38+
Version.V_8_8_0
39+
);
3240
}
3341
}

0 commit comments

Comments
 (0)