|
7 | 7 |
|
8 | 8 | package org.elasticsearch.xpack.downsample; |
9 | 9 |
|
10 | | -import org.elasticsearch.Build; |
| 10 | +import org.elasticsearch.action.admin.cluster.node.capabilities.NodesCapabilitiesRequest; |
11 | 11 | import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; |
12 | 12 | import org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction; |
13 | 13 | import org.elasticsearch.action.admin.indices.rollover.RolloverRequest; |
|
18 | 18 | import org.elasticsearch.cluster.metadata.DataStreamAction; |
19 | 19 | import org.elasticsearch.cluster.metadata.IndexMetadata; |
20 | 20 | import org.elasticsearch.common.settings.Settings; |
| 21 | +import org.elasticsearch.rest.RestRequest; |
21 | 22 | import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; |
22 | 23 | import org.elasticsearch.test.ClusterServiceUtils; |
23 | 24 | import org.elasticsearch.xcontent.XContentBuilder; |
|
35 | 36 |
|
36 | 37 | import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; |
37 | 38 | import static org.elasticsearch.xpack.downsample.DownsampleDataStreamTests.TIMEOUT; |
| 39 | +import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.METRICS_COMMAND; |
38 | 40 | import static org.hamcrest.Matchers.equalTo; |
39 | 41 | import static org.hamcrest.Matchers.hasSize; |
40 | 42 |
|
@@ -216,7 +218,11 @@ public void testAggMetricInEsqlTSAfterDownsampling() throws Exception { |
216 | 218 | }; |
217 | 219 | bulkIndex(dataStreamName, nextSourceSupplier, 100); |
218 | 220 |
|
219 | | - if (Build.current().isSnapshot() == false) { |
| 221 | + // check that TS command is available |
| 222 | + var response = clusterAdmin().nodesCapabilities( |
| 223 | + new NodesCapabilitiesRequest().method(RestRequest.Method.POST).path("/_query").capabilities(METRICS_COMMAND.capabilityName()) |
| 224 | + ).actionGet(); |
| 225 | + if (response.isSupported().orElse(Boolean.FALSE) == false) { |
220 | 226 | return; |
221 | 227 | } |
222 | 228 |
|
|
0 commit comments