﻿---
title: ES|QL KQL function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/2862/reference/query-languages/esql/functions-operators/search-functions/kql
products:
  - Elasticsearch
---

# ES|QL KQL function
<applies-to>
  - Elastic Stack: Generally available since 9.1
  - Elastic Stack: Preview in 9.0
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/2862/reference/query-languages/esql/images/functions/kql.svg)


## Parameters

<definitions>
  <definition term="query">
    Query string in KQL query string format.
  </definition>
  <definition term="options">
    (Optional) KQL additional options as [function named parameters](/elastic/docs-builder/docs/2862/reference/query-languages/esql/esql-syntax#esql-function-named-params). Available in stack version 9.3.0 and later.
  </definition>
</definitions>


## Description

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

## Supported types


| query   | options          | result  |
|---------|------------------|---------|
| keyword | named parameters | boolean |
| keyword |                  | boolean |
| text    | named parameters | boolean |
| text    |                  | boolean |


### Supported function named parameters

<definitions>
  <definition term="boost">
    (float) Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.
  </definition>
  <definition term="time_zone">
    (keyword) UTC offset or IANA time zone used to interpret date literals in the query string.
  </definition>
  <definition term="case_insensitive">
    (boolean) If true, performs case-insensitive matching for keyword fields. Defaults to false.
  </definition>
  <definition term="default_field">
    (keyword) Default field to search if no field is provided in the query string. Supports wildcards (*).
  </definition>
</definitions>


## Examples

Use KQL to filter by a specific field value
```esql
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                                     |

<applies-to>
  - Elastic Stack: Generally available since 9.3
</applies-to>

Use KQL with additional options for case-insensitive matching and custom settings
```esql
FROM employees
| WHERE KQL("mary", {"case_insensitive": true, "default_field": "first_name", "boost": 1.5})
```