Skip to content

Commit a4e9fcb

Browse files
committed
Add tests for text
1 parent e259953 commit a4e9fcb

File tree

5 files changed

+36
-9
lines changed

5 files changed

+36
-9
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
@timestamp:date ,system:keyword,message:keyword
1+
@timestamp:date ,system:keyword,message:text
22
2023-10-23T13:55:01.543Z, ping,Pinging 192.168.86.046
3-
2023-10-23T13:55:01.544Z, cron,Running cats
3+
2023-10-23T13:55:01.544Z, cron,Running cats (cycle 1)
44
2023-10-23T13:55:01.545Z, java,Doing java stuff for 192.168.86.038
55
2023-10-23T13:55:01.546Z, java,More java stuff
6+
2023-10-23T13:56:01.543Z, ping,No response
7+
2023-10-23T13:56:01.544Z, cron,Running cats (cycle 2)
8+
2023-10-23T13:57:01.544Z, cron,Running cats (cycle 3)

x-pack/plugin/esql/qa/testFixtures/src/main/resources/ip.csv-spec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,20 @@ convertFromStringFancy
301301
required_capability: to_ip_leading_zeros
302302
FROM logs
303303
| KEEP @timestamp, system, message
304+
| LIMIT 4
304305
| EVAL client = CASE(
305306
system == "ping",
306307
TO_IP(REPLACE(message, "Pinging ", ""), {"leading_zeros": "octal"}),
307308
system == "java" AND STARTS_WITH(message, "Doing java stuff for "),
308309
TO_IP(REPLACE(message, "Doing java stuff for ", ""), {"leading_zeros": "decimal"}))
309310
| SORT @timestamp
310-
| LIMIT 4
311311
;
312312

313-
@timestamp:date |system:keyword|message:keyword |client:ip
314-
2023-10-23T13:55:01.543Z| ping|Pinging 192.168.86.046 |192.168.86.38
315-
2023-10-23T13:55:01.544Z| cron|Running cats |null
316-
2023-10-23T13:55:01.545Z| java|Doing java stuff for 192.168.86.038|192.168.86.38
317-
2023-10-23T13:55:01.546Z| java|More java stuff |null
313+
@timestamp:datetime | system:keyword | message:text | client:ip
314+
2023-10-23T13:55:01.543Z | ping | Pinging 192.168.86.046 | 192.168.86.38
315+
2023-10-23T13:55:01.544Z | cron | Running cats (cycle 1) | null
316+
2023-10-23T13:55:01.545Z | java | Doing java stuff for 192.168.86.038 | 192.168.86.38
317+
2023-10-23T13:55:01.546Z | java | More java stuff | null
318318
;
319319

320320
toIpInAgg#[skip:-8.12.99,reason:StatsNestedExp introduced in v8.13.0]

x-pack/plugin/esql/qa/testFixtures/src/main/resources/mapping-logs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type" : "keyword"
88
},
99
"message" : {
10-
"type" : "keyword"
10+
"type" : "text"
1111
}
1212
}
1313
}

x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_first.csv-spec

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,15 @@ Sailaja | 1996-01-01T00:00:00.000Z
127127
Suzette | 1997-01-01T00:00:00.000Z
128128
Lillian | 1999-01-01T00:00:00.000Z
129129
;
130+
131+
first_text_by_system
132+
required_capability: agg_first_last
133+
FROM logs
134+
| STATS message = FIRST(message, @timestamp) BY system
135+
;
136+
137+
message:text | system:keyword
138+
Pinging 192.168.86.046 | ping
139+
Running cats (cycle 1) | cron
140+
Doing java stuff for 192.168.86.038 | java
141+
;

x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_last.csv-spec

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,15 @@ Sailaja | 1996-01-01T00:00:00.000Z
127127
Suzette | 1997-01-01T00:00:00.000Z
128128
Lillian | 1999-01-01T00:00:00.000Z
129129
;
130+
131+
last_text_by_system
132+
required_capability: agg_first_last
133+
FROM logs
134+
| STATS message = LAST(message, @timestamp) BY system
135+
;
136+
137+
message:text | system:keyword
138+
No response | ping
139+
Running cats (cycle 3) | cron
140+
More java stuff | java
141+
;

0 commit comments

Comments
 (0)