ES|QL MV_LIKE function
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability We plan to add this functionality in a future Elastic Stack update. Subject to changes. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Preview
Preview
Stack
Planned
Planned
Checks if any value of a multivalue field matches a wildcard pattern.
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 |