Loading

ES|QL MV_RLIKE function

Checks if any value of a multivalue field matches a regular expression.

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

Regular expression. Must be a constant. The pattern must match a value in full, as with RLIKE.

Returns true when any value yielded by field matches pattern, using the same regular-expression syntax as RLIKE. The pattern must match a value in full, as with RLIKE. RLIKE is a single-value scalar: applied to a multivalue field it emits a warning and returns null, so this is how you match a regular expression 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_rlike(names, "A.*")
		
names:keyword any_starts_with_a:boolean
[Anna, Bob, Carl] true

Character classes work as they do in RLIKE:

ROW names = ["Anna", "Bob"]
| EVAL has_three_letter_b_name = mv_rlike(names, "[Bb]ob")
		
names:keyword has_three_letter_b_name:boolean
[Anna, Bob] true