-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Kuery docs and break search page into subsections #13074
Changes from all commits
37e19f5
1358656
cc3ec30
470ce0a
58540e6
c10f547
b90a3cd
cceeaeb
4883c6e
340dcfc
944a349
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
[[kuery-query]] | ||
=== Kuery | ||
|
||
experimental[This functionality is experimental and may be changed or removed completely in a future release.] | ||
|
||
Kuery is a new query language built specifically for Kibana. It aims to simplify the search experience in Kibana | ||
and enable the creation of helpful features like auto-complete, seamless migration of saved searches, additional | ||
query types, and more. Kuery is a basic experience today but we're hard at work building these additional features on | ||
top of the foundation Kuery provides. | ||
|
||
Kueries are built with functions. Many functions take a field name as their first argument. Extremely common functions have shorthand notations. | ||
|
||
`is("response", 200)` will match documents where the response field matches the value 200. | ||
`response:200` does the same thing. `:` is an alias for the `is` function. | ||
|
||
Multiple search terms are separated by whitespace. | ||
|
||
`response:200 extension:php` will match documents where response matches 200 and extension matches php. | ||
|
||
All terms must match by default. The language supports boolean logic with and/or operators. The above query is equivalent to `response:200 and extension:php`. | ||
|
||
We can make terms optional by using `or`. | ||
|
||
`response:200 or extension:php` will match documents where response matches 200, extension matches php, or both. | ||
|
||
By default, `and` has a higher precedence than `or`. | ||
|
||
`response:200 and extension:php or extension:css` will match documents where response is 200 and extension is php OR documents where extension is css and response is anything. | ||
|
||
We can override the default precedence with grouping. | ||
|
||
`response:200 and (extension:php or extension:css)` will match documents where response is 200 and extension is either php or css. | ||
|
||
Terms can be inverted by prefixing them with `!`. | ||
|
||
`!response:200` will match all documents where response is not 200. | ||
|
||
Entire groups can also be inverted. | ||
|
||
`response:200 and !(extension:php or extension:css)` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wasn't there an invert option that uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this in mentioned in the function reference - can't hurt to show here as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the |
||
|
||
Some query functions have named arguments. | ||
|
||
`range("bytes", gt=1000, lt=8000)` will match documents where the bytes field is greater than 1000 and less than 8000. | ||
|
||
Quotes are generally optional if your terms don't have whitespace or special characters. `range(bytes, gt=1000, lt=8000)` | ||
would also be a valid query. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good job showing with and without quotes |
||
[NOTE] | ||
============ | ||
Terms without fields will be matched against all fields. For example, a query for `response:200` will search for the value 200 | ||
in the response field, but a query for just `200` will search for 200 across all fields in your index. | ||
============ | ||
|
||
==== Function Reference | ||
|
||
[horizontal] | ||
Function Name:: Description | ||
|
||
and:: | ||
Purpose::: Match all given sub-queries | ||
Alias::: `and` as a binary operator | ||
Examples::: | ||
* `and(response:200, extension:php)` | ||
* `response:200 and extension:php` | ||
|
||
or:: | ||
Purpose::: Match one or more sub-queries | ||
Alias::: `or` as a binary operator | ||
Examples::: | ||
* `or(extension:css, extension:php)` | ||
* `extension:css or extension:php` | ||
|
||
not:: | ||
Purpose::: Negates a sub-query | ||
Alias::: `!` as a prefix operator | ||
Examples::: | ||
* `not(response:200)` | ||
* `!response:200` | ||
|
||
is:: | ||
Purpose::: Matches a field with a given term | ||
Alias::: `:` | ||
Examples::: | ||
* `is("response", 200)` | ||
* `response:200` | ||
|
||
range:: | ||
Purpose::: Match a field against a range of values. | ||
Alias::: `:[]` | ||
Examples::: | ||
* `range("bytes", gt=1000, lt=8000)` | ||
* `bytes:[1000 to 8000]` | ||
Named arguments::: | ||
* `gt` - greater than | ||
* `gte` - greater than or equal to | ||
* `lt` - less than | ||
* `lte` - less than or equal to | ||
|
||
exists:: | ||
Purpose::: Match documents where a given field exists | ||
Examples::: `exists("response")` | ||
|
||
geoBoundingBox:: | ||
Purpose::: Creates a geo_bounding_box query | ||
Examples::: | ||
* `geoBoundingBox("coordinates", topLeft="40.73, -74.1", bottomRight="40.01, -71.12")` (whitespace between lat and lon is ignored) | ||
Named arguments::: | ||
* `topLeft` - the top left corner of the bounding box as a "lat, lon" string | ||
* `bottomRight` - the bottom right corner of the bounding box as a "lat, lon" string | ||
|
||
geoPolygon:: | ||
Purpose::: Creates a geo_polygon query given 3 or more points as "lat, lon" | ||
Examples::: | ||
* `geoPolygon("geo.coordinates", "40.97, -127.26", "24.20, -84.375", "40.44, -66.09")` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to add additional clarification that these helpful features (like autocomplete) aren't available now, but will be in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ explicitly stating that these features are not available today help advertise the benefits of the new language.
"It aims to simplify the search experience in Kibana and enable the creation of helpful features that aren't available today. Kuery will pave the way for features like auto-complete, seamless migration of saved searches, additional..." or something along those lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexfrancoeur I already added a clarification per Lukas's suggestion, were you looking at the most recent changes?