Skip to content

Commit 1caa2f6

Browse files
committed
[ES|QL] Enable aggregate_metric_double outside of snapshots
1 parent e89c613 commit 1caa2f6

File tree

20 files changed

+100
-83
lines changed

20 files changed

+100
-83
lines changed

x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
3838
import static org.elasticsearch.xpack.downsample.DownsampleDataStreamTests.TIMEOUT;
39-
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.AGGREGATE_METRIC_DOUBLE_IMPLICIT_CASTING_IN_AGGS;
39+
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.AGGREGATE_METRIC_DOUBLE_V0;
4040
import static org.hamcrest.Matchers.equalTo;
4141
import static org.hamcrest.Matchers.hasSize;
4242

@@ -225,11 +225,11 @@ public void testAggMetricInEsqlTSAfterDownsampling() throws Exception {
225225
};
226226
bulkIndex(dataStreamName, nextSourceSupplier, 100);
227227

228-
// check that TS command is available
228+
// check that aggregate metric double is available
229229
var response = clusterAdmin().nodesCapabilities(
230230
new NodesCapabilitiesRequest().method(RestRequest.Method.POST)
231231
.path("/_query")
232-
.capabilities(AGGREGATE_METRIC_DOUBLE_IMPLICIT_CASTING_IN_AGGS.capabilityName())
232+
.capabilities(AGGREGATE_METRIC_DOUBLE_V0.capabilityName())
233233
).actionGet();
234234
assumeTrue("Require aggregate_metric_double casting", response.isSupported().orElse(Boolean.FALSE));
235235

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/plugin/EsqlCorePlugin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@
1313

1414
public class EsqlCorePlugin extends Plugin implements ExtensiblePlugin {
1515

16-
public static final FeatureFlag AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG = new FeatureFlag("esql_aggregate_metric_double");
1716
public static final FeatureFlag DENSE_VECTOR_FEATURE_FLAG = new FeatureFlag("esql_dense_vector");
1817
}

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/type/DataType.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ public enum DataType {
331331
* </ul>
332332
*/
333333
public static final Map<DataType, FeatureFlag> UNDER_CONSTRUCTION = Map.ofEntries(
334-
Map.entry(AGGREGATE_METRIC_DOUBLE, EsqlCorePlugin.AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG),
335334
Map.entry(DENSE_VECTOR, EsqlCorePlugin.DENSE_VECTOR_FEATURE_FLAG)
336335
);
337336

x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/RestEsqlIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.elasticsearch.xcontent.XContentBuilder;
2828
import org.elasticsearch.xcontent.XContentType;
2929
import org.elasticsearch.xcontent.json.JsonXContent;
30-
import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin;
30+
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
3131
import org.elasticsearch.xpack.esql.core.type.DataType;
3232
import org.elasticsearch.xpack.esql.qa.rest.RestEsqlTestCase;
3333
import org.elasticsearch.xpack.esql.tools.ProfileParser;
@@ -744,7 +744,7 @@ public void testSuggestedCast() throws IOException {
744744
}
745745
""")
746746
);
747-
if (EsqlCorePlugin.AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG.isEnabled()) {
747+
if (EsqlCapabilities.Cap.AGGREGATE_METRIC_DOUBLE_V0.isEnabled()) {
748748
typesAndValues = new HashMap<>(typesAndValues);
749749
typesAndValues.put(DataType.AGGREGATE_METRIC_DOUBLE, """
750750
{
@@ -762,7 +762,7 @@ public void testSuggestedCast() throws IOException {
762762
shouldBeSupported.remove(DataType.DOC_DATA_TYPE);
763763
shouldBeSupported.remove(DataType.TSID_DATA_TYPE);
764764
shouldBeSupported.remove(DataType.DENSE_VECTOR);
765-
if (EsqlCorePlugin.AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG.isEnabled() == false) {
765+
if (EsqlCapabilities.Cap.AGGREGATE_METRIC_DOUBLE_V0.isEnabled() == false) {
766766
shouldBeSupported.remove(DataType.AGGREGATE_METRIC_DOUBLE);
767767
}
768768
for (DataType type : shouldBeSupported) {

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/GenerativeRestTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public abstract class GenerativeRestTest extends ESRestTestCase implements Query
7171
"Expecting at most \\[.*\\] columns, got \\[.*\\]", // https://github.com/elastic/elasticsearch/issues/129561
7272

7373
// TS-command tests
74-
"time-series .* the first aggregation .* is not allowed",
74+
"time-series.*the first aggregation.*is not allowed",
7575
"count_star .* can't be used with TS command",
7676
"time_series aggregate.* can only be used with the TS command",
7777
"Invalid call to dataType on an unresolved object \\?LASTOVERTIME", // https://github.com/elastic/elasticsearch/issues/134791

x-pack/plugin/esql/qa/testFixtures/src/main/resources/convert.csv-spec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ emp_no:integer | birth_date:datetime
455455
;
456456

457457
convertToAggregateMetricDouble
458-
required_capability: aggregate_metric_double_convert_to
458+
required_capability: aggregate_metric_double_v0
459459
//tag::toAggregateMetricDouble[]
460460
ROW x = 3892095203
461461
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(x)
@@ -469,7 +469,7 @@ x:long | agg_metric:aggregate_metric_double
469469
;
470470

471471
convertToAggregateMetricDoubleMv
472-
required_capability: aggregate_metric_double_convert_to
472+
required_capability: aggregate_metric_double_v0
473473
//tag::toAggregateMetricDoubleMv[]
474474
ROW x = [5032, 11111, 40814]
475475
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(x)
@@ -484,7 +484,7 @@ x:integer | agg_metric:aggregate_metric_double
484484

485485
convertToAggregateMetricDoubleCastingOperatorFromDouble
486486
required_capability: suggested_cast
487-
required_capability: aggregate_metric_double_convert_to
487+
required_capability: aggregate_metric_double_v0
488488
ROW x = 29384.1256
489489
| EVAL agg_metric = x::aggregate_metric_double
490490
;
@@ -495,7 +495,7 @@ x:double | agg_metric:aggregate_metric_double
495495

496496
convertToAggregateMetricDoubleCastingOperatorFromInt
497497
required_capability: suggested_cast
498-
required_capability: aggregate_metric_double_convert_to
498+
required_capability: aggregate_metric_double_v0
499499
ROW x = 55555
500500
| EVAL agg_metric = x::aggregate_metric_double
501501
;

x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-absent-over-time.csv-spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ false | staging | 2024-05-10T00:20:00.000Z
165165

166166
absent_over_time_of_aggregate_metric_double
167167
required_capability: ts_command_v0
168-
required_capability: aggregate_metric_double
168+
required_capability: aggregate_metric_double_v0
169169
TS k8s-downsampled | STATS is_present = max(absent_over_time(network.eth0.tx)) BY cluster, time_bucket = tbucket(10 minute) | SORT time_bucket, cluster | LIMIT 10;
170170

171171
is_present:boolean | cluster:keyword | time_bucket:datetime
@@ -271,7 +271,7 @@ false | staging | 2024-05-10T00:20:00.000Z
271271

272272
absent_over_time_older_than_10d
273273
required_capability: ts_command_v0
274-
required_capability: aggregate_metric_double
274+
required_capability: aggregate_metric_double_v0
275275
TS k8s-downsampled | WHERE cluster == "qa" AND @timestamp < now() - 10 day | STATS is_present = max(absent_over_time(network.eth0.rx)) BY pod, time_bucket = tbucket(10 minute) | SORT time_bucket, pod | LIMIT 5;
276276

277277
is_present:boolean | pod:keyword | time_bucket:datetime

x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-avg-over-time.csv-spec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ clients:double | cluster:keyword | time_bucket:datetime
5454

5555
avg_over_time_of_aggregate_metric_double
5656
required_capability: ts_command_v0
57-
required_capability: aggregate_metric_double
57+
required_capability: aggregate_metric_double_v0
5858
TS k8s-downsampled | STATS tx = sum(avg_over_time(network.eth0.tx)) BY time_bucket = bucket(@timestamp, 10minute) | SORT time_bucket | LIMIT 10;
5959
tx:double | time_bucket:datetime
6060
4362.2 | 2024-05-09T23:30:00.000Z
@@ -64,7 +64,7 @@ tx:double | time_bucket:datetime
6464

6565
avg_over_time_of_aggregate_metric_double_grouping
6666
required_capability: ts_command_v0
67-
required_capability: aggregate_metric_double
67+
required_capability: aggregate_metric_double_v0
6868
TS k8s-downsampled | STATS tx = sum(avg_over_time(network.eth0.tx)) BY cluster, time_bucket = bucket(@timestamp, 10minute) | SORT time_bucket, cluster | LIMIT 10;
6969

7070
tx:double | cluster:keyword | time_bucket:datetime
@@ -113,7 +113,7 @@ tx:double | cluster:keyword | time_bucket:datetime
113113

114114
avg_over_time_older_than_10d
115115
required_capability: ts_command_v0
116-
required_capability: aggregate_metric_double
116+
required_capability: aggregate_metric_double_v0
117117
TS k8s-downsampled | WHERE cluster == "qa" AND @timestamp < now() - 10 day | STATS cost = avg(avg_over_time(network.eth0.rx)) BY pod, time_bucket = bucket(@timestamp, 10minute) | SORT time_bucket, pod | LIMIT 5;
118118

119119
cost:double | pod:keyword | time_bucket:datetime
@@ -192,7 +192,7 @@ events:double | pod:keyword | time_bucket:datetime
192192

193193
avg_over_time_aggregate_metric_double_implicit_casting
194194
required_capability: ts_command_v0
195-
required_capability: aggregate_metric_double_implicit_casting_in_aggs
195+
required_capability: aggregate_metric_double_v0
196196
TS k8s* | STATS bytes = sum(avg_over_time(network.eth0.rx)) by time_bucket = bucket(@timestamp, 10minute) | SORT bytes desc, time_bucket | LIMIT 10 ;
197197

198198
bytes:double | time_bucket:datetime
@@ -206,7 +206,7 @@ bytes:double | time_bucket:datetime
206206

207207
avg_over_time_aggregate_metric_double_implicit_casting_grouping
208208
required_capability: ts_command_v0
209-
required_capability: aggregate_metric_double_implicit_casting_in_aggs
209+
required_capability: aggregate_metric_double_v0
210210
TS k8s* | STATS bytes = sum(avg_over_time(network.eth0.rx)) by pod, time_bucket = bucket(@timestamp, 10minute) | SORT bytes desc, pod, time_bucket | LIMIT 10 ;
211211

212212
bytes:double | pod:keyword | time_bucket:datetime

x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-count-over-time.csv-spec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pod:long | cluster:keyword | time_bucket:datetime
144144

145145
count_over_time_of_aggregate_metric_double
146146
required_capability: ts_command_v0
147-
required_capability: aggregate_metric_double
147+
required_capability: aggregate_metric_double_v0
148148
TS k8s-downsampled | STATS tx = sum(count_over_time(network.eth0.tx)) BY cluster, time_bucket = bucket(@timestamp, 10minute) | SORT time_bucket, cluster | LIMIT 10;
149149

150150
tx:long | cluster:keyword | time_bucket:datetime
@@ -241,7 +241,7 @@ tx:long | cluster:keyword | time_bucket:datetime
241241

242242
count_over_time_older_than_10d
243243
required_capability: ts_command_v0
244-
required_capability: aggregate_metric_double
244+
required_capability: aggregate_metric_double_v0
245245
TS k8s-downsampled | WHERE cluster == "qa" AND @timestamp < now() - 10 day | STATS cost = avg(count_over_time(network.eth0.rx)) BY pod, time_bucket = bucket(@timestamp, 10minute) | SORT time_bucket, pod | LIMIT 5;
246246

247247
cost:double | pod:keyword | time_bucket:datetime
@@ -321,7 +321,7 @@ events:long | pod:keyword | time_bucket:datetime
321321

322322
count_over_time_aggregate_metric_double_implicit_casting
323323
required_capability: ts_command_v0
324-
required_capability: aggregate_metric_double_implicit_casting_in_aggs
324+
required_capability: aggregate_metric_double_v0
325325
TS k8s* | STATS bytes = sum(count_over_time(network.eth0.rx)) by pod, time_bucket = bucket(@timestamp, 10minute) | SORT bytes, pod, time_bucket | LIMIT 10 ;
326326

327327
bytes:long | pod:keyword | time_bucket:datetime

x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-max-over-time.csv-spec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ one | staging | 2024-05-10T00:03:00.000Z
290290

291291
max_over_time_of_aggregate_metric_double
292292
required_capability: ts_command_v0
293-
required_capability: aggregate_metric_double
293+
required_capability: aggregate_metric_double_v0
294294
TS k8s-downsampled | STATS tx = sum(max_over_time(network.eth0.tx)) BY time_bucket = bucket(@timestamp, 10minute) | SORT time_bucket | LIMIT 10;
295295
tx:double | time_bucket:datetime
296296
6053.0 | 2024-05-09T23:30:00.000Z
@@ -300,7 +300,7 @@ tx:double | time_bucket:datetime
300300

301301
max_over_time_of_aggregate_metric_double_grouping
302302
required_capability: ts_command_v0
303-
required_capability: aggregate_metric_double
303+
required_capability: aggregate_metric_double_v0
304304
TS k8s-downsampled | STATS tx = sum(max_over_time(network.eth0.tx)) BY cluster, time_bucket = bucket(@timestamp, 10minute) | SORT time_bucket, cluster | LIMIT 10;
305305

306306
tx:double | cluster:keyword | time_bucket:datetime
@@ -333,7 +333,7 @@ tx:long | cluster:keyword | time_bucket:datetime
333333

334334
max_over_time_older_than_10h
335335
required_capability: ts_command_v0
336-
required_capability: aggregate_metric_double
336+
required_capability: aggregate_metric_double_v0
337337
TS k8s-downsampled | WHERE cluster == "qa" AND @timestamp < now() - 10 day | STATS cost = avg(max_over_time(network.eth0.rx)) BY pod, time_bucket = bucket(@timestamp, 10minute) | SORT time_bucket, pod | LIMIT 5;
338338

339339
cost:double | pod:keyword | time_bucket:datetime
@@ -429,7 +429,7 @@ events:long | pod:keyword | time_bucket:datetime
429429

430430
max_over_time_aggregate_metric_double_implicit_casting
431431
required_capability: ts_command_v0
432-
required_capability: aggregate_metric_double_implicit_casting_in_aggs
432+
required_capability: aggregate_metric_double_v0
433433
TS k8s* | STATS bytes = sum(max_over_time(network.eth0.rx)) by time_bucket = bucket(@timestamp, 10minute) | SORT bytes desc, time_bucket | LIMIT 10 ;
434434

435435
bytes:double | time_bucket:datetime
@@ -443,7 +443,7 @@ bytes:double | time_bucket:datetime
443443

444444
max_over_time_aggregate_metric_double_implicit_casting_grouping
445445
required_capability: ts_command_v0
446-
required_capability: aggregate_metric_double_implicit_casting_in_aggs
446+
required_capability: aggregate_metric_double_v0
447447
TS k8s* | STATS bytes = sum(max_over_time(network.eth0.rx)) by pod, time_bucket = bucket(@timestamp, 10minute) | SORT bytes desc, pod, time_bucket | LIMIT 10 ;
448448

449449
bytes:double | pod:keyword | time_bucket:datetime

0 commit comments

Comments
 (0)