Type to search.

ES|QL KQL function

Serverless

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack GA 9.1+ …

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Generally available since 9.1

    This functionality is generally available and ready for production usage.

  • Preview in 9.0

    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.

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.

Performs a KQL query and returns true if it matches the row.

Embedded
Embedded
query
Query string in KQL query string format.
options

(Optional) KQL additional options as function named parameters. Available in stack version 9.3.0 and later.

Performs a KQL query. Returns true if the provided KQL query string matches the row.

Tip

Learn more about using ES|QL for search use cases.

query options result
keyword named parameters boolean
text named parameters boolean
case_insensitive
(boolean) If true, performs case-insensitive matching for keyword fields. Defaults to false.
time_zone
(keyword) UTC offset or IANA time zone used to interpret date literals in the query string.
default_field
(keyword) Default field to search if no field is provided in the query string. Supports wildcards (*).
boost

(float) Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.

Use KQL to filter by a specific field value

ES|QL
FROM books
| WHERE KQL("author: Faulkner")
book_no:keyword author:text
2378 [Carol Faulkner, Holly Byers Ochoa, Lucretia Mott]
2713 William Faulkner
2847 Colleen Faulkner
2883 William Faulkner
3293 Danny Faulkner

Stack 9.3+

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Generally available since 9.3

    This functionality is generally available and ready for production usage.

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.

Use KQL with additional options for case-insensitive matching and custom settings

ES|QL
FROM employees
| WHERE KQL("mary", {"case_insensitive": true, "default_field": "first_name", "boost": 1.5})