@@ -16,11 +16,6 @@ setup:
16
16
type : long
17
17
geo_point :
18
18
type : geo_point
19
- nested :
20
- type : nested
21
- properties :
22
- nested_long :
23
- type : long
24
19
25
20
- do :
26
21
indices.create :
@@ -32,11 +27,6 @@ setup:
32
27
type : date
33
28
long :
34
29
type : long
35
- nested :
36
- type : nested
37
- properties :
38
- nested_long :
39
- type : long
40
30
41
31
- do :
42
32
indices.create :
@@ -61,23 +51,118 @@ setup:
61
51
semester :
62
52
type : keyword
63
53
54
+ - do :
55
+ indices.create :
56
+ index : nonesting
57
+ body :
58
+ mappings :
59
+ properties :
60
+ kw :
61
+ type : keyword
62
+ num :
63
+ type : integer
64
+
65
+ - do :
66
+ index :
67
+ index : nonesting
68
+ id : 1
69
+ body : { "kw": "one", "num": 1 }
70
+
71
+ - do :
72
+ index :
73
+ index : nonesting
74
+ id : 2
75
+ body : { "kw": "two", "num": 2 }
76
+
77
+ - do :
78
+ index :
79
+ index : nonesting
80
+ id : 3
81
+ body : { "kw": "three", "num": 3 }
82
+
64
83
- do :
65
84
index :
66
85
index : verynested
67
86
id : 1
68
- body : { "department": "compsci", "staff": 12, "courses": [ { "name": "Object Oriented Programming", "credits": 3, "sessions": [ { "semester": "spr2021", "students": 37 }, { "semester": "fall2020", "students": 45} ] }, { "name": "Theory of Computation", "credits": 4, "sessions": [ { "semester": "spr2021", "students": 19 }, { "semester": "fall2020", "students": 14 } ] } ] }
87
+ body : {
88
+ " department " : " compsci" ,
89
+ " staff " : 12,
90
+ " courses " : [
91
+ {
92
+ " name " : " Object Oriented Programming" ,
93
+ " credits " : 3,
94
+ " sessions " : [
95
+ {
96
+ " semester " : " spr2021" ,
97
+ " students " : 37
98
+ },
99
+ {
100
+ " semester " : " fall2020" ,
101
+ " students " : 45
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ " name " : " Theory of Computation" ,
107
+ " credits " : 4,
108
+ " sessions " : [
109
+ {
110
+ " semester " : " spr2021" ,
111
+ " students " : 19
112
+ },
113
+ {
114
+ " semester " : " fall2020" ,
115
+ " students " : 14
116
+ }
117
+ ]
118
+ }
119
+ ]
120
+ }
69
121
70
122
- do :
71
123
index :
72
124
index : verynested
73
125
id : 2
74
- body : { "department": "math", "staff": 20, "courses": [ { "name": "Precalculus", "credits": 1, "sessions": [ { "semester": "spr2021", "students": 100 }, { "semester": "fall2020", "students": 134 } ] }, { "name": "Linear Algebra", "credits": 3, "sessions": [ { "semester": "spr2021", "students": 29 }, { "semester": "fall2020", "students": 23 } ] } ] }
126
+ body : {
127
+ " department " : " math" ,
128
+ " staff " : 20,
129
+ " courses " : [
130
+ {
131
+ " name " : " Precalculus" ,
132
+ " credits " : 1,
133
+ " sessions " : [
134
+ {
135
+ " semester " : " spr2021" ,
136
+ " students " : 100
137
+ },
138
+ {
139
+ " semester " : " fall2020" ,
140
+ " students " : 134
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ " name " : " Linear Algebra" ,
146
+ " credits " : 3,
147
+ " sessions " : [
148
+ {
149
+ " semester " : " spr2021" ,
150
+ " students " : 29
151
+ },
152
+ {
153
+ " semester " : " fall2020" ,
154
+ " students " : 23
155
+ }
156
+ ]
157
+ }
158
+ ]
159
+ }
75
160
76
161
- do :
77
162
index :
78
163
index : test
79
164
id : 1
80
- body : { "keyword": "foo", "long": [10, 20], "geo_point": "37.2343,-115.8067", "nested": [{"nested_long": 10}, {"nested_long": 20}] }
165
+ body : { "keyword": "foo", "long": [10, 20], "geo_point": "37.2343,-115.8067"}
81
166
82
167
- do :
83
168
index :
@@ -89,13 +174,13 @@ setup:
89
174
index :
90
175
index : test
91
176
id : 3
92
- body : { "keyword": "bar", "long": [100, 0], "geo_point": "90.0,0.0", "nested": [{"nested_long": 10}, {"nested_long": 0}] }
177
+ body : { "keyword": "bar", "long": [100, 0], "geo_point": "90.0,0.0"}
93
178
94
179
- do :
95
180
index :
96
181
index : test
97
182
id : 4
98
- body : { "keyword": "bar", "long": [1000, 0], "geo_point": "41.12,-71.34", "nested": [{"nested_long": 1000}, {"nested_long": 20}] }
183
+ body : { "keyword": "bar", "long": [1000, 0], "geo_point": "41.12,-71.34"}
99
184
100
185
- do :
101
186
index :
@@ -117,7 +202,7 @@ setup:
117
202
118
203
- do :
119
204
indices.refresh :
120
- index : [test, other, verynested]
205
+ index : [test, other, verynested, nonesting ]
121
206
122
207
---
123
208
" Simple Composite aggregation " :
@@ -265,7 +350,7 @@ setup:
265
350
terms :
266
351
field : long
267
352
aggs :
268
- nested :
353
+ invalid_child :
269
354
composite :
270
355
sources : [
271
356
{
@@ -485,67 +570,6 @@ setup:
485
570
}
486
571
]
487
572
488
- ---
489
- " Composite aggregation with nested parent " :
490
- - do :
491
- search :
492
- rest_total_hits_as_int : true
493
- index : test
494
- body :
495
- aggregations :
496
- 1 :
497
- nested :
498
- path : nested
499
- aggs :
500
- 2 :
501
- composite :
502
- sources : [
503
- " nested " : {
504
- " terms " : {
505
- " field " : " nested.nested_long"
506
- }
507
- }
508
- ]
509
-
510
- - match : {hits.total: 6}
511
- - length : { aggregations.1.2.buckets: 4 }
512
- - match : { aggregations.1.2.buckets.0.key.nested: 0 }
513
- - match : { aggregations.1.2.buckets.0.doc_count: 1 }
514
- - match : { aggregations.1.2.buckets.1.key.nested: 10 }
515
- - match : { aggregations.1.2.buckets.1.doc_count: 2 }
516
- - match : { aggregations.1.2.buckets.2.key.nested: 20 }
517
- - match : { aggregations.1.2.buckets.2.doc_count: 2 }
518
- - match : { aggregations.1.2.buckets.3.key.nested: 1000 }
519
- - match : { aggregations.1.2.buckets.3.doc_count: 1 }
520
-
521
- - do :
522
- search :
523
- rest_total_hits_as_int : true
524
- index : test
525
- body :
526
- aggregations :
527
- 1 :
528
- nested :
529
- path : nested
530
- aggs :
531
- 2 :
532
- composite :
533
- after : { "nested": 10 }
534
- sources : [
535
- " nested " : {
536
- " terms " : {
537
- " field " : " nested.nested_long"
538
- }
539
- }
540
- ]
541
-
542
- - match : {hits.total: 6}
543
- - length : { aggregations.1.2.buckets: 2 }
544
- - match : { aggregations.1.2.buckets.0.key.nested: 20 }
545
- - match : { aggregations.1.2.buckets.0.doc_count: 2 }
546
- - match : { aggregations.1.2.buckets.1.key.nested: 1000 }
547
- - match : { aggregations.1.2.buckets.1.doc_count: 1 }
548
-
549
573
---
550
574
" Composite aggregation with unmapped field " :
551
575
- skip :
@@ -1120,3 +1144,78 @@ setup:
1120
1144
- match : { aggregations.courses.sessions.names.buckets.0.doc_count: 4}
1121
1145
- match : { aggregations.courses.sessions.names.buckets.1.key.kw: "spr2021" }
1122
1146
- match : { aggregations.courses.sessions.names.buckets.1.doc_count: 4}
1147
+
1148
+ ---
1149
+ " Nested then filter then nested then terms " :
1150
+ - skip :
1151
+ version : " - 7.99.99"
1152
+ reason : Filter support not backported yet
1153
+ - do :
1154
+ search :
1155
+ rest_total_hits_as_int : true
1156
+ index : verynested
1157
+ body :
1158
+ " aggregations " : {
1159
+ " courses " : {
1160
+ " nested " : { "path": "courses" },
1161
+ " aggregations " : {
1162
+ " highpass_filter " : {
1163
+ " filter " : { "range": {"courses.credits": { "gt": 1 }}},
1164
+ " aggregations " : {
1165
+ " sessions " : {
1166
+ " nested " : { "path": "courses.sessions" },
1167
+ " aggregations " : {
1168
+ " names " : {
1169
+ " composite " : {
1170
+ " sources " : [
1171
+ " kw " : {"terms": { "field": "courses.sessions.semester" }}
1172
+ ]
1173
+ }
1174
+ }
1175
+ }
1176
+ }
1177
+ }
1178
+ }
1179
+ }
1180
+ }
1181
+ }
1182
+ - match : {hits.total: 2}
1183
+ - match : {aggregations.courses.doc_count: 4}
1184
+ - match : {aggregations.courses.highpass_filter.doc_count: 3}
1185
+ - match : {aggregations.courses.highpass_filter.sessions.doc_count: 6}
1186
+ - length : { aggregations.courses.highpass_filter.sessions.names.buckets: 2 }
1187
+ - match : { aggregations.courses.highpass_filter.sessions.names.buckets.0.key.kw: "fall2020" }
1188
+ - match : { aggregations.courses.highpass_filter.sessions.names.buckets.0.doc_count: 3}
1189
+ - match : { aggregations.courses.highpass_filter.sessions.names.buckets.1.key.kw: "spr2021" }
1190
+ - match : { aggregations.courses.highpass_filter.sessions.names.buckets.1.doc_count: 3}
1191
+
1192
+ ---
1193
+ " Filter without nesting " :
1194
+ - skip :
1195
+ version : " - 7.99.99"
1196
+ reason : Filter support not backported yet
1197
+ - do :
1198
+ search :
1199
+ rest_total_hits_as_int : true
1200
+ index : nonesting
1201
+ body : {
1202
+ " aggs " : {
1203
+ " not_one " : {
1204
+ " filter " : { "range": {"num": {"gt": 1}} },
1205
+ " aggs " : {
1206
+ " keez " : {
1207
+ " composite " : {
1208
+ " sources " : [
1209
+ " key " : {"terms": {"field": "kw"}}
1210
+ ]
1211
+ }
1212
+ }
1213
+ }
1214
+ }
1215
+ }
1216
+ }
1217
+ - match : {hits.total: 3}
1218
+ - match : {aggregations.not_one.doc_count: 2}
1219
+ - length : {aggregations.not_one.keez.buckets: 2}
1220
+ - match : {aggregations.not_one.keez.buckets.0.key.key: "three"}
1221
+ - match : {aggregations.not_one.keez.buckets.1.key.key: "two"}
0 commit comments