Skip to content

Commit 1ffd63e

Browse files
committed
test fix
1 parent 2914a35 commit 1ffd63e

1 file changed

Lines changed: 56 additions & 45 deletions

File tree

quickwit/rest-api-tests/scenarii/aggregations/0001-aggregations.yaml

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ expected:
4242
- { "doc_count": 2, "key": 1422662400000.0, "key_as_string": "2015-01-31T00:00:00Z" }
4343
- { "doc_count": 0, "key": 1425254400000.0, "key_as_string": "2015-03-02T00:00:00Z" }
4444
---
45-
# Test date histogram aggregation and sub-aggregation
45+
# Test date histogram aggregation and sub-aggregation
4646
method: [GET]
4747
engines:
4848
- quickwit
4949
endpoint: _elastic/aggregations/_search
5050
json:
5151
query: { match_all: {} }
5252
aggs:
53-
date_histo:
54-
date_histogram:
53+
date_histo:
54+
date_histogram:
5555
field: "date"
5656
fixed_interval: "30d"
5757
offset: "-4d"
@@ -65,8 +65,8 @@ expected:
6565
buckets:
6666
- { "doc_count": 5, "key": 1420070400000.0, "key_as_string": "2015-01-01T00:00:00Z", "response": { "avg": 85.0, "count": 4, "max": 120.0, "min": 20.0, "sum": 340.0 } }
6767
- { "doc_count": 2, "key": 1422662400000.0, "key_as_string": "2015-01-31T00:00:00Z", "response": { "avg": 80.0, "count": 2, "max": 130.0, "min": 30.0, "sum": 160.0 } }
68-
---
69-
# Test date histogram aggregation + exists and sub-aggregation
68+
---
69+
# Test date histogram aggregation + exists and sub-aggregation
7070
method: [GET]
7171
engines:
7272
- quickwit
@@ -78,8 +78,8 @@ json:
7878
- exists:
7979
field: response
8080
aggs:
81-
date_histo:
82-
date_histogram:
81+
date_histo:
82+
date_histogram:
8383
field: "date"
8484
fixed_interval: "30d"
8585
offset: "-4d"
@@ -93,7 +93,7 @@ expected:
9393
buckets:
9494
- { "doc_count": 4, "key": 1420070400000.0, "key_as_string": "2015-01-01T00:00:00Z", "response": { "avg": 85.0, "count": 4, "max": 120.0, "min": 20.0, "sum": 340.0 } }
9595
- { "doc_count": 2, "key": 1422662400000.0, "key_as_string": "2015-01-31T00:00:00Z", "response": { "avg": 80.0, "count": 2, "max": 130.0, "min": 30.0, "sum": 160.0 } }
96-
---
96+
---
9797
# Test range aggregation
9898
method: [GET]
9999
engines:
@@ -103,7 +103,7 @@ json:
103103
query: { match_all: {} }
104104
aggs:
105105
my_range:
106-
range:
106+
range:
107107
field: response
108108
ranges:
109109
- { to: 50, key: fast }
@@ -116,7 +116,7 @@ expected:
116116
- { "doc_count": 5, "key": "fast", "to": 50.0 }
117117
- { "doc_count": 0, "from": 50.0, "key": "medium", "to": 80.0 }
118118
- { "doc_count": 4, "from": 80.0, "key": "slow" }
119-
---
119+
---
120120
# Test term aggs
121121
method: [GET]
122122
engines:
@@ -125,11 +125,11 @@ endpoint: _elastic/aggregations/_search
125125
json:
126126
query: { match_all: {} }
127127
aggs:
128-
hosts:
129-
terms:
128+
hosts:
129+
terms:
130130
field: "host"
131-
tags:
132-
terms:
131+
tags:
132+
terms:
133133
field: "tags"
134134
expected:
135135
aggregations:
@@ -151,7 +151,7 @@ expected:
151151
key: cool
152152
doc_count_error_upper_bound: 0
153153
sum_other_doc_count: 0
154-
---
154+
---
155155
# Test term aggs with split_size
156156
# We set split_size to 1, so one document with name "Fritz" will be missing from one split.
157157
method: [GET]
@@ -161,23 +161,23 @@ endpoint: _elastic/aggregations/_search
161161
json:
162162
query: { match_all: {} }
163163
aggs:
164-
names:
165-
terms:
164+
names:
165+
terms:
166166
field: "name"
167167
size: 1
168168
split_size: 1
169169
expected:
170170
aggregations:
171171
names:
172172
buckets:
173-
# There are 3 documents with name "Fritz" but we only get 2. One does not get passed to the
173+
# There are 3 documents with name "Fritz" but we only get 2. One does not get passed to the
174174
# root node, because it gets cut off due to the split_size parameter set to 1.
175175
# We also get doc_count_error_upper_bound: 2, which signals that the result is approximate.
176-
- doc_count: 2
176+
- doc_count: 2
177177
key: "Fritz"
178178
sum_other_doc_count: 8
179179
doc_count_error_upper_bound: 2
180-
---
180+
---
181181
# Test term aggs with shard_size
182182
# segment_size is an alias to shard_size
183183
method: [GET]
@@ -187,23 +187,23 @@ endpoint: _elastic/aggregations/_search
187187
json:
188188
query: { match_all: {} }
189189
aggs:
190-
names:
191-
terms:
190+
names:
191+
terms:
192192
field: "name"
193193
size: 1
194194
segment_size: 1
195195
expected:
196196
aggregations:
197197
names:
198198
buckets:
199-
# There are 3 documents with name "Fritz" but we only get 2. One does not get passed to the
199+
# There are 3 documents with name "Fritz" but we only get 2. One does not get passed to the
200200
# root node, because it gets cut off due to the split_size parameter set to 1.
201201
# We also get doc_count_error_upper_bound: 2, which signals that the result is approximate.
202-
- doc_count: 2
202+
- doc_count: 2
203203
key: "Fritz"
204204
sum_other_doc_count: 8
205205
doc_count_error_upper_bound: 2
206-
---
206+
---
207207
# Test term aggs with shard_size
208208
method: [GET]
209209
engines:
@@ -212,19 +212,19 @@ endpoint: _elastic/aggregations/_search
212212
json:
213213
query: { match_all: {} }
214214
aggs:
215-
names:
216-
terms:
215+
names:
216+
terms:
217217
field: "name"
218218
size: 1
219219
shard_size: 1
220220
expected:
221221
aggregations:
222222
names:
223223
buckets:
224-
# There are 3 documents with name "Fritz" but we only get 2. One does not get passed to the
224+
# There are 3 documents with name "Fritz" but we only get 2. One does not get passed to the
225225
# root node, because it gets cut off due to the split_size parameter set to 1.
226226
# We also get doc_count_error_upper_bound: 2, which signals that the result is approximate.
227-
- doc_count: 2
227+
- doc_count: 2
228228
key: "Fritz"
229229
sum_other_doc_count: 8
230230
doc_count_error_upper_bound: 2
@@ -238,8 +238,8 @@ endpoint: _elastic/aggregations/_search
238238
json:
239239
query: { match_all: {} }
240240
aggs:
241-
names:
242-
terms:
241+
names:
242+
terms:
243243
field: "name"
244244
size: 1
245245
split_size: 5
@@ -249,11 +249,11 @@ expected:
249249
buckets:
250250
# We get all 3 documents with name "Fritz"
251251
# We also get doc_count_error_upper_bound: 0, to the result is exact.
252-
- doc_count: 3
252+
- doc_count: 3
253253
key: "Fritz"
254254
sum_other_doc_count: 7
255255
doc_count_error_upper_bound: 0
256-
---
256+
---
257257
# Test date histogram + percentiles sub-aggregation
258258
method: [GET]
259259
engines:
@@ -284,15 +284,17 @@ expected:
284284
response:
285285
values:
286286
- key: 85.0
287-
value: 100.49456770856702
287+
value:
288+
$expect: 'abs(val - 100.49456770856702) < 0.1'
288289
- doc_count: 2
289290
key: 1422662400000.0
290291
key_as_string: '2015-01-31T00:00:00Z'
291292
response:
292293
values:
293294
- key: 85.0
294-
value: 30.26717133872237
295-
---
295+
value:
296+
$expect: 'abs(val - 30.2617) < 0.1'
297+
---
296298
# Test histogram
297299
method: [GET]
298300
engines:
@@ -316,7 +318,7 @@ expected:
316318
- doc_count: 4
317319
key: 100.0
318320

319-
---
321+
---
320322
# Test histogram empty result on empty index
321323
method: [GET]
322324
engines:
@@ -354,11 +356,14 @@ json:
354356
expected:
355357
aggregations:
356358
unique_names:
357-
value: 8.0
359+
value:
360+
$expect: 'abs(val - 8) <= 2'
358361
unique_response:
359-
value: 5.0 # TODO: Check. The correct number is 6
362+
value:
363+
$expect: 'abs(val - 6) <= 2' # TODO: Check. The correct number is 6
360364
unique_dates:
361-
value: 6.0
365+
value:
366+
$expect: 'abs(val - 6) <= 3'
362367
---
363368
# Test extended stats aggregation
364369
method: [GET]
@@ -385,8 +390,8 @@ json:
385390
query: { match_all: {} }
386391
size: 0
387392
aggs:
388-
names:
389-
terms:
393+
names:
394+
terms:
390395
field: "high_prec_test"
391396
expected:
392397
aggregations:
@@ -433,9 +438,15 @@ expected:
433438
- key: { "host": "192.168.0.10", "name": "Albert", "response": 100.0 }
434439
doc_count: 1
435440
after_key:
436-
host: "192.168.0.10"
437-
name: "Albert"
438-
response: 100.0
441+
host:
442+
# tantivy does not coerce.
443+
# For this reason, we can have 2 fields with the different types, and tantivy
444+
# needs to prepend after key with its type. std:
445+
$expect: "val in ['192.168.0.10', 'str:192.168.0.10']"
446+
name:
447+
$expect: "val in ['Albert', 'str:Albert']"
448+
response:
449+
$expect: val in [100.0, 'f64:100']
439450

440451
---
441452
# Test composite aggregation paging

0 commit comments

Comments
 (0)