Skip to content

Commit 4871f47

Browse files
authored
Add a REST layer test for reverse_nested (#83874)
REST layer tests are how we get backwards compatibility testing. So they are important! The `reverse_nested` aggregation doesn't have any configuration. Like, none. But it didn't have any REST tests at all which is a shame. This adds one.
1 parent 76a2489 commit 4871f47

File tree

1 file changed

+34
-0
lines changed
  • rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.aggregation

1 file changed

+34
-0
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.aggregation/380_nested.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ setup:
124124
- match: { aggregations.courses.sessions.names.buckets.0.doc_count: 4}
125125
- match: { aggregations.courses.sessions.names.buckets.1.key: "spr2021" }
126126
- match: { aggregations.courses.sessions.names.buckets.1.doc_count: 4}
127+
127128
---
128129
"Nested then filter then nested then terms":
129130
- do:
@@ -160,3 +161,36 @@ setup:
160161
- match: { aggregations.courses.highpass_filter.sessions.names.buckets.0.doc_count: 3}
161162
- match: { aggregations.courses.highpass_filter.sessions.names.buckets.1.key: "spr2021" }
162163
- match: { aggregations.courses.highpass_filter.sessions.names.buckets.1.doc_count: 3}
164+
165+
---
166+
"Nested then filter then nested then reverse nested":
167+
- do:
168+
search:
169+
index: test
170+
body:
171+
aggregations:
172+
courses:
173+
nested:
174+
path: courses
175+
aggregations:
176+
highpass_filter:
177+
filter:
178+
range:
179+
courses.credits:
180+
gt: 1
181+
aggregations:
182+
unnest:
183+
reverse_nested: {}
184+
aggregations:
185+
department:
186+
terms:
187+
field: department
188+
- match: {hits.total.value: 2}
189+
- match: {aggregations.courses.doc_count: 4}
190+
- match: {aggregations.courses.highpass_filter.doc_count: 3}
191+
- match: {aggregations.courses.highpass_filter.unnest.doc_count: 2}
192+
- length: { aggregations.courses.highpass_filter.unnest.department.buckets: 2 }
193+
- match: { aggregations.courses.highpass_filter.unnest.department.buckets.0.key: compsci }
194+
- match: { aggregations.courses.highpass_filter.unnest.department.buckets.0.doc_count: 1 }
195+
- match: { aggregations.courses.highpass_filter.unnest.department.buckets.1.key: math }
196+
- match: { aggregations.courses.highpass_filter.unnest.department.buckets.1.doc_count: 1 }

0 commit comments

Comments
 (0)