8282                time_series_dimension : true 
8383              agg_metric :
8484                type : aggregate_metric_double 
85-                 #  TODO: tests with a subset of metrics
8685                metrics : [ min, max, sum, value_count ] 
8786                default_metric : max 
8887              k8s :
@@ -104,6 +103,80 @@ setup:
104103          - ' {"@timestamp": "2021-04-28T18:50:04.467Z", "dim": "A", "agg_metric": {"max": 10, "min": -1, "sum": 20, "value_count": 5}}' 
105104          - ' {"index": {}}' 
106105          - ' {"@timestamp": "2021-04-28T18:50:24.467Z", "dim": "B", "agg_metric": {"max": 20, "min": 3, "sum": 50, "value_count": 7}}' 
106+           - ' {"index": {}}' 
107+           - ' {"@timestamp": "2021-04-28T18:50:44.467Z", "dim": "B", "agg_metric": {"max": 17, "min": -5, "sum": 33, "value_count": 9}}' 
108+ 
109+   - do :
110+       indices.create :
111+         index : test3 
112+         body :
113+           settings :
114+             index :
115+               mode : time_series 
116+               routing_path : [ k8s.pod.uid ] 
117+               time_series :
118+                 start_time : 2021-04-28T00:00:00Z 
119+                 end_time : 2021-04-29T00:00:00Z 
120+           mappings :
121+             properties :
122+               " @timestamp "  :
123+                 type : date 
124+               agg_metric :
125+                 type : aggregate_metric_double 
126+                 metrics : [ min, max ] 
127+                 default_metric : min 
128+               k8s :
129+                 properties :
130+                   pod :
131+                     properties :
132+                       uid :
133+                         type : keyword 
134+                         time_series_dimension : true 
135+   - do :
136+       bulk :
137+         refresh : true 
138+         index : test3 
139+         body :
140+           - ' {"index": {}}' 
141+           - ' {"@timestamp": "2021-04-28T19:50:04.467Z", "agg_metric": {"max": 1, "min": -3}, "k8s": {"pod": {"uid":"947e4ced-1786-4e53-9e0c-5c447e959507"}}}' 
142+           - ' {"index": {}}' 
143+           - ' {"@timestamp": "2021-04-28T19:50:24.467Z", "agg_metric": {"max": 10, "min": 3}, "k8s": {"pod": {"uid":"947e4ced-1786-4e53-9e0c-5c447e959507"}}}' 
144+           - ' {"index": {}}' 
145+           - ' {"@timestamp": "2021-04-28T19:50:44.467Z", "agg_metric": {"max": 17, "min": 2}, "k8s": {"pod": {"uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9"}}}' 
146+ 
147+   - do :
148+       indices.create :
149+         index : test4 
150+         body :
151+           settings :
152+             index :
153+               mode : time_series 
154+               routing_path : [ k8s.pod.uid ] 
155+               time_series :
156+                 start_time : 2021-04-28T00:00:00Z 
157+                 end_time : 2021-04-29T00:00:00Z 
158+           mappings :
159+             properties :
160+               " @timestamp "  :
161+                 type : date 
162+               agg_metric :
163+                 type : aggregate_metric_double 
164+                 metrics : [ sum, value_count ] 
165+                 default_metric : sum 
166+               k8s :
167+                 properties :
168+                   pod :
169+                     properties :
170+                       uid :
171+                         type : keyword 
172+                         time_series_dimension : true 
173+   - do :
174+       bulk :
175+         refresh : true 
176+         index : test4 
177+         body :
178+           - ' {"index": {}}' 
179+           - ' {"@timestamp": "2021-04-28T23:50:04.467Z", "agg_metric": {"sum": 1, "value_count": 10}, "k8s": {"pod": {"uid":"947e4ced-1786-4e53-9e0c-5c447e959507"}}}' 
107180
108181---
109182load everything :
@@ -228,7 +301,7 @@ from doc with aggregate_metric_double:
228301  - match : {columns.3.type: "ip"} 
229302  - match : {columns.4.name: "k8s.pod.network.tx"} 
230303  - match : {columns.4.type: "long"} 
231-   - length : {values: 2 } 
304+   - length : {values: 3 } 
232305
233306---
234307stats on aggregate_metric_double :
@@ -257,12 +330,12 @@ stats on aggregate_metric_double:
257330  - match : {columns.3.name: "count(agg_metric)"} 
258331  - match : {columns.3.type: "long"} 
259332  - match : {values.0.0: 20.0} 
260-   - match : {values.0.1: -1 .0} 
261-   - match : {values.0.2: 70 .0} 
262-   - match : {values.0.3: 12 .0} 
333+   - match : {values.0.1: -5 .0} 
334+   - match : {values.0.2: 103 .0} 
335+   - match : {values.0.3: 21 .0} 
263336
264337---
265- from index pattern unsupported counter :
338+ grouping stats on aggregate_metric_double :
266339  - requires :
267340      test_runner_features : [capabilities] 
268341      capabilities :
@@ -271,6 +344,119 @@ from index pattern unsupported counter:
271344          parameters : [] 
272345          capabilities : [aggregate_metric_double] 
273346      reason : " Support for aggregate_metric_double" 
347+   - do :
348+       allowed_warnings_regex :
349+         - " No limit defined, adding default limit of \\ [.*\\ ]" 
350+       esql.query :
351+         body :
352+           query : " FROM test2
353+           | STATS max(agg_metric), min(agg_metric), sum(agg_metric), count(agg_metric) BY dim 
354+           | SORT dim"  
355+   - length : {values: 2} 
356+   - length : {values.0: 5} 
357+   - match : {columns.0.name: "max(agg_metric)"} 
358+   - match : {columns.0.type: "double"} 
359+   - match : {columns.1.name: "min(agg_metric)"} 
360+   - match : {columns.1.type: "double"} 
361+   - match : {columns.2.name: "sum(agg_metric)"} 
362+   - match : {columns.2.type: "double"} 
363+   - match : {columns.3.name: "count(agg_metric)"} 
364+   - match : {columns.3.type: "long"} 
365+   - match : {columns.4.name: "dim"} 
366+   - match : {columns.4.type: "keyword"} 
367+   - match : {values.0.0: 10.0} 
368+   - match : {values.0.1: -1.0} 
369+   - match : {values.0.2: 20.0} 
370+   - match : {values.0.3: 5.0} 
371+   - match : {values.0.4: "A"} 
372+   - match : {values.1.0: 20.0} 
373+   - match : {values.1.1: -5.0} 
374+   - match : {values.1.2: 83.0} 
375+   - match : {values.1.3: 16.0} 
376+   - match : {values.1.4: "B"} 
377+ 
378+ ---
379+ stats on aggregate_metric_double with partial submetrics :
380+   - requires :
381+       test_runner_features : [capabilities] 
382+       capabilities :
383+         - method : POST 
384+           path : /_query 
385+           parameters : [] 
386+           capabilities : [aggregate_metric_double_partial_submetrics] 
387+       reason : " Support for partial submetrics in aggregate_metric_double" 
388+   - do :
389+       allowed_warnings_regex :
390+         - " No limit defined, adding default limit of \\ [.*\\ ]" 
391+       esql.query :
392+         body :
393+           query : ' FROM test3 | STATS max(agg_metric), min(agg_metric), sum(agg_metric), count(agg_metric) BY k8s.pod.uid | SORT k8s.pod.uid' 
394+ 
395+   - length : {values: 2} 
396+   - length : {values.0: 5} 
397+   - match : {columns.0.name: "max(agg_metric)"} 
398+   - match : {columns.0.type: "double"} 
399+   - match : {columns.1.name: "min(agg_metric)"} 
400+   - match : {columns.1.type: "double"} 
401+   - match : {columns.2.name: "sum(agg_metric)"} 
402+   - match : {columns.2.type: "double"} 
403+   - match : {columns.3.name: "count(agg_metric)"} 
404+   - match : {columns.3.type: "long"} 
405+   - match : {columns.4.name: "k8s.pod.uid"} 
406+   - match : {columns.4.type: "keyword"} 
407+   - match : {values.0.0: 10.0} 
408+   - match : {values.0.1: -3.0} 
409+   - match : {values.0.2: null} 
410+   - match : {values.0.3: null} 
411+   - match : {values.0.4: "947e4ced-1786-4e53-9e0c-5c447e959507"} 
412+   - match : {values.1.0: 17.0} 
413+   - match : {values.1.1: 2.0} 
414+   - match : {values.1.2: null} 
415+   - match : {values.1.3: null} 
416+   - match : {values.1.4: "df3145b3-0563-4d3b-a0f7-897eb2876ea9"} 
417+ 
418+ ---
419+ stats on aggregate_metric_double missing min and max :
420+   - requires :
421+       test_runner_features : [ capabilities ] 
422+       capabilities :
423+         - method : POST 
424+           path : /_query 
425+           parameters : [ ] 
426+           capabilities : [ aggregate_metric_double_partial_submetrics ] 
427+       reason : " Support for partial submetrics in aggregate_metric_double" 
428+   - do :
429+       allowed_warnings_regex :
430+         - " No limit defined, adding default limit of \\ [.*\\ ]" 
431+       esql.query :
432+         body :
433+           query : ' FROM test4 | STATS max(agg_metric), min(agg_metric), sum(agg_metric), count(agg_metric)' 
434+ 
435+   - length : {values: 1} 
436+   - length : {values.0: 4} 
437+   - match : {columns.0.name: "max(agg_metric)"} 
438+   - match : {columns.0.type: "double"} 
439+   - match : {columns.1.name: "min(agg_metric)"} 
440+   - match : {columns.1.type: "double"} 
441+   - match : {columns.2.name: "sum(agg_metric)"} 
442+   - match : {columns.2.type: "double"} 
443+   - match : {columns.3.name: "count(agg_metric)"} 
444+   - match : {columns.3.type: "long"} 
445+   - match : {values.0.0: null} 
446+   - match : {values.0.1: null} 
447+   - match : {values.0.2: 1.0} 
448+   - match : {values.0.3: 10} 
449+ 
450+ ---
451+ from index pattern unsupported counter :
452+   - requires :
453+       test_runner_features : [capabilities] 
454+       capabilities :
455+         - method : POST 
456+           path : /_query 
457+           parameters : [] 
458+           capabilities : [aggregate_metric_double_partial_submetrics] 
459+       reason : " Support for partial submetrics in aggregate_metric_double" 
274460  - do :
275461      allowed_warnings_regex :
276462        - " No limit defined, adding default limit of \\ [.*\\ ]" 
@@ -296,7 +482,7 @@ from index pattern unsupported counter:
296482  - match : {columns.7.type: "keyword"} 
297483  - match : {columns.8.name: "metricset"} 
298484  - match : {columns.8.type: "keyword"} 
299-   - length : {values: 10 } 
485+   - length : {values: 15 } 
300486
301487---
302488from index pattern explicit counter use :
@@ -317,7 +503,7 @@ from index pattern explicit counter use:
317503          query : ' FROM test* | keep *.tx' 
318504  - match : {columns.0.name: "k8s.pod.network.tx"} 
319505  - match : {columns.0.type: "unsupported"} 
320-   - length : {values: 10 } 
506+   - length : {values: 15 } 
321507
322508---
323509_source :
0 commit comments