Skip to content

Commit 4804ada

Browse files
committed
add yaml test
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent 8568c2f commit 4804ada

1 file changed

Lines changed: 171 additions & 0 deletions

File tree

  • integ-test/src/yamlRestTest/resources/rest-api-spec/test/issues
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
setup:
2+
- do:
3+
indices.create:
4+
index: test_filter_merge
5+
body:
6+
settings:
7+
number_of_shards: 1
8+
number_of_replicas: 0
9+
mappings:
10+
properties:
11+
name:
12+
type: keyword
13+
age:
14+
type: integer
15+
email:
16+
type: keyword
17+
status:
18+
type: keyword
19+
score:
20+
type: double
21+
city:
22+
type: keyword
23+
department:
24+
type: keyword
25+
active:
26+
type: boolean
27+
- do:
28+
query.settings:
29+
body:
30+
transient:
31+
plugins.calcite.enabled : true
32+
33+
---
34+
teardown:
35+
- do:
36+
query.settings:
37+
body:
38+
transient:
39+
plugins.calcite.enabled : false
40+
41+
---
42+
"Filter merge with multiple consecutive where clauses":
43+
- skip:
44+
features:
45+
- headers
46+
- allowed_warnings
47+
- do:
48+
bulk:
49+
index: test_filter_merge
50+
refresh: true
51+
body:
52+
- '{"index": {}}'
53+
- '{"name": "Alice", "age": 30, "email": "alice@example.com", "status": "active", "score": 95.5, "city": "Seattle", "department": "Engineering", "active": true}'
54+
- '{"index": {}}'
55+
- '{"name": "Bob", "age": 25, "email": "bob@example.com", "status": "active", "score": 88.0, "city": "Portland", "department": "Sales", "active": true}'
56+
- '{"index": {}}'
57+
- '{"name": "Charlie", "age": 35, "email": "charlie@example.com", "status": "inactive", "score": 72.5, "city": "Seattle", "department": "Engineering", "active": false}'
58+
- '{"index": {}}'
59+
- '{"name": "Diana", "age": 28, "email": "diana@example.com", "status": "active", "score": 91.0, "city": "Seattle", "department": "Marketing", "active": true}'
60+
- '{"index": {}}'
61+
- '{"name": "Eve", "age": 32, "email": "eve@example.com", "status": "active", "score": 85.5, "city": "Portland", "department": "Engineering", "active": true}'
62+
63+
- do:
64+
allowed_warnings:
65+
- 'Loading the fielddata on the _id field is deprecated and will be removed in future versions. If you require sorting or aggregating on this field you should also include the id in the body of your documents, and map this field as a keyword field that has [doc_values] enabled'
66+
headers:
67+
Content-Type: 'application/json'
68+
ppl:
69+
body:
70+
query: |
71+
source=test_filter_merge
72+
| where name != ""
73+
| where email != ""
74+
| where status = "active"
75+
| where age > 25
76+
| where age < 40
77+
| where score > 80
78+
| where score < 100
79+
| where city = "Seattle"
80+
| where department = "Engineering"
81+
| where active = true
82+
| fields name, age, email, score
83+
84+
- match: {"total": 1}
85+
- match: {"datarows": [["Alice", 30, "alice@example.com", 95.5]]}
86+
87+
---
88+
"Filter merge with IS NOT NULL checks":
89+
- skip:
90+
features:
91+
- headers
92+
- allowed_warnings
93+
- do:
94+
bulk:
95+
index: test_filter_merge
96+
refresh: true
97+
body:
98+
- '{"index": {}}'
99+
- '{"name": "Frank", "age": 40, "email": "frank@example.com", "status": "active", "score": 78.0, "city": "Boston", "department": "Sales", "active": true}'
100+
- '{"index": {}}'
101+
- '{"name": "Grace", "age": 35, "email": "", "status": "active", "score": 92.0, "city": "Boston", "department": "Sales", "active": true}'
102+
- '{"index": {}}'
103+
- '{"name": "", "age": 29, "email": "helen@example.com", "status": "active", "score": 80.0, "city": "Boston", "department": "Sales", "active": true}'
104+
105+
- do:
106+
allowed_warnings:
107+
- 'Loading the fielddata on the _id field is deprecated and will be removed in future versions. If you require sorting or aggregating on this field you should also include the id in the body of your documents, and map this field as a keyword field that has [doc_values] enabled'
108+
headers:
109+
Content-Type: 'application/json'
110+
ppl:
111+
body:
112+
query: |
113+
source=test_filter_merge
114+
| where name != ""
115+
| where email != ""
116+
| where status = "active"
117+
| where isnotnull(score)
118+
| where age > 30
119+
| where age < 50
120+
| where score > 70
121+
| where city = "Boston"
122+
| where department = "Sales"
123+
| where active = true
124+
| fields name, email, status, score
125+
126+
- match: {"total": 1}
127+
- match: {"datarows": [["Frank", "frank@example.com", "active", 78.0]]}
128+
129+
---
130+
"Filter merge with range and equality checks":
131+
- skip:
132+
features:
133+
- headers
134+
- allowed_warnings
135+
- do:
136+
bulk:
137+
index: test_filter_merge
138+
refresh: true
139+
body:
140+
- '{"index": {}}'
141+
- '{"name": "Ivan", "age": 27, "email": "ivan@example.com", "status": "active", "score": 85.0, "city": "Seattle", "department": "HR", "active": true}'
142+
- '{"index": {}}'
143+
- '{"name": "Julia", "age": 33, "email": "julia@example.com", "status": "active", "score": 90.0, "city": "Portland", "department": "HR", "active": true}'
144+
- '{"index": {}}'
145+
- '{"name": "Kevin", "age": 45, "email": "kevin@example.com", "status": "active", "score": 88.0, "city": "Seattle", "department": "HR", "active": false}'
146+
- '{"index": {}}'
147+
- '{"name": "Laura", "age": 26, "email": "laura@example.com", "status": "inactive", "score": 75.0, "city": "Seattle", "department": "HR", "active": true}'
148+
149+
- do:
150+
allowed_warnings:
151+
- 'Loading the fielddata on the _id field is deprecated and will be removed in future versions. If you require sorting or aggregating on this field you should also include the id in the body of your documents, and map this field as a keyword field that has [doc_values] enabled'
152+
headers:
153+
Content-Type: 'application/json'
154+
ppl:
155+
body:
156+
query: |
157+
source=test_filter_merge
158+
| where status = "active"
159+
| where age >= 25
160+
| where age <= 35
161+
| where score >= 85
162+
| where score <= 95
163+
| where city = "Seattle"
164+
| where name != ""
165+
| where email != ""
166+
| where department = "HR"
167+
| where active = true
168+
| stats count() by city
169+
170+
- match: {"total": 1}
171+
- match: {"datarows": [[1, "Seattle"]]}

0 commit comments

Comments
 (0)