|
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,9 +218,11 @@ public void testAggMetricInEsqlTSAfterDownsampling() throws Exception {
|
216 | 218 | };
|
217 | 219 | bulkIndex(dataStreamName, nextSourceSupplier, 100);
|
218 | 220 |
|
219 |
| - if (Build.current().isSnapshot() == false) { |
220 |
| - return; |
221 |
| - } |
| 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 | + assumeTrue("TS command must be available for this test", response.isSupported().orElse(Boolean.FALSE)); |
222 | 226 |
|
223 | 227 | // Since the downsampled field (cpu) is downsampled in one index and not in the other, we want to confirm
|
224 | 228 | // first that the field is unsupported and has 2 original types - double and aggregate_metric_double
|
|
0 commit comments