Loading

ES|QL MV_LIKE function

Checks if any value of a multivalue field matches a wildcard pattern.

Embedded
field
Multivalue expression to test. If null or empty, the function returns false.
pattern

Wildcard pattern. Must be a constant. * matches any run of characters, ? matches a single character; escape either with \.

Returns true when any value yielded by field matches pattern, using the same wildcard syntax as LIKE. LIKE is a single-value scalar: applied to a multivalue field it emits a warning and returns null, so this is how you match a wildcard pattern against a multivalue field. A null or empty field returns false, and because the result is never null the predicate composes under AND/OR/NOT.

field pattern result
keyword keyword boolean
keyword text boolean
text keyword boolean
text text boolean
ROW names = ["Anna", "Bob", "Carl"]
| EVAL any_starts_with_a = mv_like(names, "A*")
		
names:keyword any_starts_with_a:boolean
[Anna, Bob, Carl] true

A prefix pattern matches when any value starts with the literal:

ROW names = ["Anna", "Bob"]
| EVAL has_bo = mv_like(names, "Bo*")
		
names:keyword has_bo:boolean
[Anna, Bob] true

Because the result is never null, it composes under NOT:

ROW names = ["Anna", "Bob"]
| EVAL no_carl = NOT mv_like(names, "Carl*")
		
names:keyword no_carl:boolean
[Anna, Bob] true