Skip to content

Commit 39fcbff

Browse files
authored
Adds some REST tests for boxplot metric aggregations. (#78354) (#78419)
Adds more REST tests for boxplot metric aggregations. Related to #26220
1 parent 5c4ef48 commit 39fcbff

File tree

1 file changed

+57
-0
lines changed
  • x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/analytics

1 file changed

+57
-0
lines changed

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/analytics/boxplot.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ setup:
3535
- index:
3636
_index: "latency"
3737
- load_time: 15
38+
39+
- index:
40+
_index: "latency"
41+
- { }
42+
3843
---
3944
"Basic Search":
4045

@@ -54,3 +59,55 @@ setup:
5459
- match: { aggregations.plot.q2: 5.0 }
5560
- match: { aggregations.plot.q3: 11.25 }
5661

62+
---
63+
"Search With Runtime Field":
64+
65+
- do:
66+
search:
67+
index: "latency"
68+
body:
69+
query:
70+
exists:
71+
field: load_time
72+
runtime_mappings:
73+
load_time_adjusted:
74+
type: long
75+
script:
76+
source: "emit((long)((doc['load_time'].value == 10 ? 1000 : doc['load_time'].value) * params.multiplier))"
77+
params:
78+
multiplier: 10
79+
size: 0
80+
aggs:
81+
plot:
82+
boxplot:
83+
field: "load_time_adjusted"
84+
85+
- match: { aggregations.plot.min: 20.0 }
86+
- match: { aggregations.plot.max: 10000.0 }
87+
- match: { aggregations.plot.q1: 27.5 }
88+
- match: { aggregations.plot.q2: 50.0 }
89+
- match: { aggregations.plot.q3: 2612.5 }
90+
- match: { aggregations.plot.lower: 20.0 }
91+
- match: { aggregations.plot.upper: 150.0 }
92+
93+
---
94+
"Search With Missing":
95+
96+
- do:
97+
search:
98+
index: "latency"
99+
body:
100+
size: 0
101+
aggs:
102+
plot:
103+
boxplot:
104+
field: "load_time"
105+
missing: 10000
106+
107+
- match: { aggregations.plot.min: 2.0 }
108+
- match: { aggregations.plot.max: 10000.0 }
109+
- match: { aggregations.plot.q1: 3 }
110+
- match: { aggregations.plot.q2: 7.5 }
111+
- match: { aggregations.plot.q3: 15.0 }
112+
- match: { aggregations.plot.lower: 2.0 }
113+
- match: { aggregations.plot.upper: 15.0 }

0 commit comments

Comments
 (0)