Skip to content

Commit 81f7c08

Browse files
committed
Adds ES|QL test
1 parent 0e2a05b commit 81f7c08

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/esql/10_query.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
requires:
3+
serverless: true
4+
stack: true
5+
---
6+
setup:
7+
- do:
8+
indices.create:
9+
index: esql-test
10+
body:
11+
mappings:
12+
properties: { 'client.ip': { 'type': 'ip' }, 'message': { 'type': 'keyword' } }
13+
- do:
14+
bulk:
15+
refresh: true
16+
index: esql-test
17+
body:
18+
- "index": {}
19+
- { "@timestamp": "2023-10-23T12:15:03.360Z", "client.ip": "172.21.2.162", "message": "Connected to 10.1.0.3", "event.duration": 3450233 }
20+
- "index": {}
21+
- { "@timestamp": "2023-10-23T12:27:28.948Z", "client.ip": "172.21.2.113", "message": "Connected to 10.1.0.2", "event.duration": 2764889 }
22+
- "index": {}
23+
- { "@timestamp": "2023-10-23T13:33:34.937Z", "client.ip": "172.21.0.5", "message": "Disconnected", "event.duration": 1232382 }
24+
- "index": {}
25+
- { "@timestamp": "2023-10-23T13:51:54.732Z", "client.ip": "172.21.3.15", "message": "Connection error", "event.duration": 725448 }
26+
- "index": {}
27+
- { "@timestamp": "2023-10-23T13:52:55.015Z", "client.ip": "172.21.3.15", "message": "Connection error", "event.duration": 8268153 }
28+
- "index": {}
29+
- { "@timestamp": "2023-10-23T13:53:55.832Z", "client.ip": "172.21.3.15", "message": "Connection error", "event.duration": 5033755 }
30+
- "index": {}
31+
- { "@timestamp": "2023-10-23T13:55:01.543Z", "client.ip": "172.21.3.15", "message": "Connected to 10.1.0.1", "event.duration": 1756467 }
32+
---
33+
teardown:
34+
- do:
35+
indices.delete:
36+
index: esql-test
37+
---
38+
"ES|QL":
39+
- do:
40+
esql.query:
41+
body:
42+
query: "FROM esql-test | EVAL duration_ms = ROUND(event.duration / 1000000.0, 1)"
43+
- match: { columns.0.name: "@timestamp" }
44+
- match: { columns.0.type: "date" }
45+
- match: { columns.1.name: "client.ip" }
46+
- match: { columns.1.type: "ip" }
47+
- match: { columns.2.name: "event.duration" }
48+
- match: { columns.2.type: "long" }
49+
- match: { columns.3.name: "message" }
50+
- match: { columns.3.type: "keyword" }
51+
- match: { columns.4.name: "duration_ms" }
52+
- match: { columns.4.type: "double" }

0 commit comments

Comments
 (0)