Skip to content

Commit 62a5246

Browse files
aggregator and yaml tests for missing agg (#53214)
Tests for unmapped fields, the missing parameter, scripting, and correct ValuesSource types in MissingAggregatorTests. Basic yaml tests for the missing agg For #42949
1 parent 9496369 commit 62a5246

File tree

2 files changed

+507
-111
lines changed

2 files changed

+507
-111
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
setup:
2+
- do:
3+
indices.create:
4+
index: test
5+
body:
6+
settings:
7+
number_of_replicas: 0
8+
mappings:
9+
properties:
10+
field1:
11+
type: long
12+
field2:
13+
type: long
14+
field3:
15+
type: long
16+
- do:
17+
bulk:
18+
refresh: true
19+
body:
20+
- index:
21+
_index: test
22+
- field1: 100
23+
- index:
24+
_index: test
25+
- field1: 200
26+
- index:
27+
_index: test
28+
- field1: 300
29+
field2: 300
30+
31+
---
32+
"match all":
33+
34+
- do:
35+
search:
36+
rest_total_hits_as_int: true
37+
body:
38+
aggs:
39+
missing_agg:
40+
missing:
41+
field: field3
42+
43+
- match: { hits.total: 3 }
44+
- length: { hits.hits: 3 }
45+
46+
- match: { aggregations.missing_agg.doc_count: 3 }
47+
48+
---
49+
"match some":
50+
51+
- do:
52+
search:
53+
rest_total_hits_as_int: true
54+
body:
55+
aggs:
56+
missing_agg:
57+
missing:
58+
field: field2
59+
60+
- match: { hits.total: 3 }
61+
- length: { hits.hits: 3 }
62+
63+
- match: { aggregations.missing_agg.doc_count: 2 }
64+
65+
---
66+
"match none":
67+
68+
- do:
69+
search:
70+
rest_total_hits_as_int: true
71+
body:
72+
aggs:
73+
missing_agg:
74+
missing:
75+
field: field1
76+
77+
- match: { hits.total: 3 }
78+
- length: { hits.hits: 3 }
79+
80+
- match: { aggregations.missing_agg.doc_count: 0 }
81+
82+
---
83+
"missing param":
84+
85+
- do:
86+
search:
87+
rest_total_hits_as_int: true
88+
body:
89+
aggs:
90+
missing_agg:
91+
missing:
92+
field: field3
93+
missing: 1
94+
95+
- match: { hits.total: 3 }
96+
- length: { hits.hits: 3 }
97+
98+
- match: { aggregations.missing_agg.doc_count: 0 }

0 commit comments

Comments
 (0)