Skip to content

Commit 71a5d28

Browse files
committed
Add a test case for issue 4340
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent 168ea9e commit 71a5d28

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

  • integ-test/src/yamlRestTest/resources/rest-api-spec/test/issues
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
setup:
2+
- do:
3+
query.settings:
4+
body:
5+
transient:
6+
plugins.calcite.enabled : true
7+
8+
---
9+
teardown:
10+
- do:
11+
query.settings:
12+
body:
13+
transient:
14+
plugins.calcite.enabled : false
15+
16+
---
17+
"Fix bin with grouped stats on timestamp field":
18+
- skip:
19+
features:
20+
- headers
21+
- allowed_warnings
22+
- do:
23+
indices.create:
24+
index: test-bin-stats
25+
body:
26+
mappings:
27+
properties:
28+
"@timestamp":
29+
type: date
30+
process:
31+
properties:
32+
name:
33+
type: keyword
34+
35+
- do:
36+
bulk:
37+
index: test-bin-stats
38+
refresh: true
39+
body:
40+
- '{"index": {}}'
41+
- '{ "@timestamp" : "2023-01-01T05:10:44.000Z", "process": { "name": "sshd" } }'
42+
- '{"index": {}}'
43+
- '{ "@timestamp" : "2023-01-01T07:18:55.000Z", "process": { "name": "cron" } }'
44+
- '{"index": {}}'
45+
- '{ "@timestamp" : "2023-01-01T04:33:24.000Z", "process": { "name": "kernel" } }'
46+
- '{"index": {}}'
47+
- '{ "@timestamp" : "2022-12-31T18:49:28.000Z", "process": { "name": "cron" } }'
48+
- '{"index": {}}'
49+
- '{ "@timestamp" : "2023-01-01T10:23:39.000Z", "process": { "name": "cron" } }'
50+
51+
- do:
52+
allowed_warnings:
53+
- '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'
54+
headers:
55+
Content-Type: 'application/json'
56+
ppl:
57+
body:
58+
query: source=test-bin-stats | bin `@timestamp` span=1d | stats count() by `@timestamp`
59+
60+
- match: { total: 2 }
61+
- length: { datarows: 2 }
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: source=test-bin-stats | bin `@timestamp` span=1d | stats count() by `@timestamp`, process.name | sort `@timestamp`, process.name
71+
72+
- match: { total: 4 }
73+
- length: { datarows: 4 }

0 commit comments

Comments
 (0)