Skip to content

Commit b43eb5a

Browse files
authored
[DOCS] EQL: Document endsWith function (elastic#54521)
1 parent 7787603 commit b43eb5a

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

docs/reference/eql/functions.asciidoc

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,90 @@ experimental::[]
88

99
{es} supports the following EQL functions:
1010

11+
* <<eql-fn-endswith>>
1112
* <<eql-fn-startswith>>
1213
* <<eql-fn-substring>>
1314

15+
[discrete]
16+
[[eql-fn-endswith]]
17+
=== `endsWith`
18+
19+
Returns `true` if a source string ends with a provided substring. Matching is
20+
case insensitive.
21+
22+
[%collapsible]
23+
====
24+
*Example*
25+
[source,eql]
26+
----
27+
endsWith("regsvr32.exe", ".exe") // returns true
28+
endsWith("regsvr32.exe", ".EXE") // returns true
29+
endsWith("regsvr32.exe", ".dll") // returns false
30+
endsWith("", "") // returns true
31+
32+
// file.name = "regsvr32.exe"
33+
endsWith(file.name, ".exe") // returns true
34+
endsWith(file.name, ".dll") // returns false
35+
36+
// file.extension = ".exe"
37+
endsWith("regsvr32.exe", file.extension) // returns true
38+
endsWith("ntdll.dll", file.name) // returns false
39+
40+
// file.name = [ "ntdll.dll", "regsvr32.exe" ]
41+
endsWith(file.name, ".dll") // returns true
42+
endsWith(file.name, ".exe") // returns false
43+
44+
// null handling
45+
endsWith("regsvr32.exe", null) // returns null
46+
endsWith("", null) // returns null
47+
endsWith(null, ".exe") // returns null
48+
endsWith(null, null) // returns null
49+
----
50+
51+
*Syntax*
52+
53+
[source,txt]
54+
----
55+
endsWith(<source>, <substring>)
56+
----
57+
58+
*Parameters*
59+
60+
`<source>`::
61+
+
62+
--
63+
(Required, string or `null`)
64+
Source string. If `null`, the function returns `null`.
65+
66+
If using a field as the argument, this parameter only supports the following
67+
field datatypes:
68+
69+
* <<keyword,`keyword`>>
70+
* <<constant-keyword,`constant_keyword`>>
71+
* <<text,`text`>> field with a <<keyword,`keyword`>> or
72+
<<constant-keyword,`constant_keyword`>> sub-field
73+
74+
Fields containing array values use the first array item only.
75+
--
76+
77+
`<substring>`::
78+
+
79+
--
80+
(Required, string or `null`)
81+
Substring to search for. If `null`, the function returns `null`.
82+
83+
If using a field as the argument, this parameter only supports the following
84+
field datatypes:
85+
86+
* <<keyword,`keyword`>>
87+
* <<constant-keyword,`constant_keyword`>>
88+
* <<text,`text`>> field with a <<keyword,`keyword`>> or
89+
<<constant-keyword,`constant_keyword`>> sub-field
90+
--
91+
92+
*Returns:* boolean or `null`
93+
====
94+
1495
[discrete]
1596
[[eql-fn-startswith]]
1697
=== `startsWith`

0 commit comments

Comments
 (0)