forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4469.yml
More file actions
61 lines (56 loc) · 1.92 KB
/
Copy path4469.yml
File metadata and controls
61 lines (56 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
setup:
- do:
query.settings:
body:
transient:
plugins.calcite.enabled : true
- do:
indices.create:
index: test
body:
mappings:
properties:
"timestamp":
type: date
"status":
type: integer
"client_ip":
type: ip
- do:
bulk:
index: test
refresh: true
body:
- '{"index":{}}'
- '{"datetime":"2025-01-15T00:30:00Z","status":200,"client_ip":"10.0.0.1"}'
- '{"index":{}}'
- '{"datetime":"2025-01-15T02:15:00Z","status":200,"client_ip":"10.0.0.2"}'
- '{"index":{}}'
- '{"datetime":"2025-01-15T10:50:00Z","status":200,"client_ip":"10.0.0.11"}'
- '{"index":{}}'
- '{"datetime":"2025-01-15T23:45:00Z","status":200,"client_ip":"10.0.0.24"}'
---
teardown:
- do:
query.settings:
body:
transient:
plugins.calcite.enabled : false
---
"agg with script and sort on group key":
- skip:
features:
- headers
- allowed_warnings
- do:
allowed_warnings:
- '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'
headers:
Content-Type: 'application/json'
ppl:
body:
query: source=test | eval hour_of_day = HOUR(datetime) | stats count() as request_count by hour_of_day | sort hour_of_day asc
- match: { total: 4 }
- match: { "schema": [ { "name": "request_count", "type": "bigint" }, { "name": "hour_of_day", "type": "int" }] }
# it got [[1, 0], [1, 10], [1, 2], [1, 23]] without the fix of this issue
- match: {"datarows": [[1, 0], [1, 2], [1, 10], [1, 23]]}