Skip to content

Commit b75d5c5

Browse files
[A&E] Refine query languages intro, ESQL and Query DSL (#306)
* add base 'write to scratch' content to Explore and Analyze * img paths * query languages intro, query dsl, and esql * Update explore-analyze/query-filter.md Co-authored-by: Liam Thompson <[email protected]> * fix img paths back to relative * more img paths * img width --------- Co-authored-by: Liam Thompson <[email protected]>
1 parent 6b6e257 commit b75d5c5

File tree

28 files changed

+300
-387
lines changed

28 files changed

+300
-387
lines changed

explore-analyze/alerts/kibana/rule-type-es-query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ When you create an {{es}} query rule, your choice of query type affects the info
3737

3838
If you use [KQL](../../query-filter/languages/kql.md) or [Lucene](../../query-filter/languages/lucene-query-syntax.md), you must specify a data view then define a text-based query. For example, `http.request.referrer: "https://example.com"`.
3939

40-
If you use [ES|QL](../../query-filter/languages/esorql.md), you must provide a source command followed by an optional series of processing commands, separated by pipe characters (|). [8.16.0] For example:
40+
If you use [ES|QL](../../query-filter/languages/esql.md), you must provide a source command followed by an optional series of processing commands, separated by pipe characters (|). [8.16.0] For example:
4141

4242
```sh
4343
FROM kibana_sample_data_logs

explore-analyze/discover/try-esql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The Elasticsearch Query Language, {{esql}}, makes it easier to explore your data
1010
In this tutorial we’ll use the {{kib}} sample web logs in Discover and Lens to explore the data and create visualizations.
1111

1212
::::{tip}
13-
For the complete {{esql}} documentation, including tutorials, examples and the full syntax reference, refer to the [{{es}} documentation](../query-filter/languages/esorql.md). For a more detailed overview of {{esql}} in {{kib}}, refer to [Use {{esql}} in Kibana](../query-filter/languages/esql-kibana.md).
13+
For the complete {{esql}} documentation, including tutorials, examples and the full syntax reference, refer to the [{{es}} documentation](../query-filter/languages/esql.md). For a more detailed overview of {{esql}} in {{kib}}, refer to [Use {{esql}} in Kibana](../query-filter/languages/esql-kibana.md).
1414

1515
::::
1616

explore-analyze/geospatial-analysis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Data is often messy and incomplete. [Ingest pipelines](../manage-data/ingest/tra
3434

3535
## ES|QL [esql-query]
3636

37-
[ES|QL](query-filter/languages/esorql.md) has support for [Geospatial Search](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-functions-operators.html#esql-spatial-functions) functions, enabling efficient index searching for documents that intersect with, are within, are contained by, or are disjoint from a query geometry. In addition, the `ST_DISTANCE` function calculates the distance between two points.
37+
[ES|QL](query-filter/languages/esql.md) has support for [Geospatial Search](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-functions-operators.html#esql-spatial-functions) functions, enabling efficient index searching for documents that intersect with, are within, are contained by, or are disjoint from a query geometry. In addition, the `ST_DISTANCE` function calculates the distance between two points.
3838

3939
* [`ST_INTERSECTS`](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-functions-operators.html#esql-st_intersects)
4040
* [`ST_DISJOINT`](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-functions-operators.html#esql-st_disjoint)

explore-analyze/query-filter.md

Lines changed: 9 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,20 @@ mapped_pages:
77

88
You can use {{es}} as a basic document store to retrieve documents and their metadata. However, the real power of {{es}} comes from its advanced search and analytics capabilities.
99

10-
You’ll use a combination of an API endpoint and a query language to interact with your data.
11-
12-
13-
## REST API [search-analyze-rest-api]
14-
15-
Use REST APIs to manage your {{es}} cluster, and to index and search your data. For testing purposes, you can submit requests directly from the command line or through the Dev Tools [Console](query-filter/tools/console.md) in {{kib}}. From your applications, you can use a [client](https://www.elastic.co/guide/en/elasticsearch/client/index.md) in your programming language of choice.
16-
17-
Refer to [first steps with Elasticsearch](../solutions/search/get-started.md) for a hands-on example of using the `_search` endpoint, adding data to {{es}}, and running basic searches in Query DSL syntax.
18-
19-
20-
## Query languages [search-analyze-query-languages]
21-
22-
{{es}} provides a number of query languages for interacting with your data.
23-
24-
**Query DSL** is the primary query language for {{es}} today.
25-
26-
**{{esql}}** is a new piped query language and compute engine which was first added in version **8.11**.
27-
28-
{{esql}} does not yet support all the features of Query DSL. Look forward to new {{esql}} features and functionalities in each release.
29-
30-
Refer to [Query languages](#search-analyze-query-languages) for a full overview of the query languages available in {{es}}.
31-
32-
33-
### Query DSL [search-analyze-query-dsl]
34-
35-
[Query DSL](query-filter/languages/querydsl.md) is a full-featured JSON-style query language that enables complex searching, filtering, and aggregations. It is the original and most powerful query language for {{es}} today.
36-
37-
The [`_search` endpoint](../solutions/search/querying-for-search.md) accepts queries written in Query DSL syntax.
38-
10+
## Querying
3911

40-
#### Search and filter with Query DSL [search-analyze-query-dsl-search-filter]
41-
42-
Query DSL support a wide range of search techniques, including the following:
43-
44-
* [**Full-text search**](../solutions/search/full-text.md): Search text that has been analyzed and indexed to support phrase or proximity queries, fuzzy matches, and more.
45-
* [**Keyword search**](https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html): Search for exact matches using `keyword` fields.
46-
* [**Semantic search**](../solutions/search/semantic-search/semantic-search-semantic-text.md): Search `semantic_text` fields using dense or sparse vector search on embeddings generated in your {{es}} cluster.
47-
* [**Vector search**](../solutions/search/vector/knn.md): Search for similar dense vectors using the kNN algorithm for embeddings generated outside of {{es}}.
48-
* [**Geospatial search**](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-queries.html): Search for locations and calculate spatial relationships using geospatial queries.
49-
50-
Learn about the full range of queries supported by [Query DSL](query-filter/languages/querydsl.md).
51-
52-
You can also filter data using Query DSL. Filters enable you to include or exclude documents by retrieving documents that match specific field-level criteria. A query that uses the `filter` parameter indicates [filter context](query-filter/languages/querydsl.md#filter-context).
53-
54-
55-
#### Analyze with Query DSL [search-analyze-data-query-dsl]
56-
57-
[Aggregations](aggregations.md) are the primary tool for analyzing {{es}} data using Query DSL. Aggregrations enable you to build complex summaries of your data and gain insight into key metrics, patterns, and trends.
58-
59-
Because aggregations leverage the same data structures used for search, they are also very fast. This enables you to analyze and visualize your data in real time. You can search documents, filter results, and perform analytics at the same time, on the same data, in a single request. That means aggregations are calculated in the context of the search query.
60-
61-
The folowing aggregation types are available:
62-
63-
* [Metric](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics.html): Calculate metrics, such as a sum or average, from field values.
64-
* [Bucket](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket.html): Group documents into buckets based on field values, ranges, or other criteria.
65-
* [Pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html): Run aggregations on the results of other aggregations.
66-
67-
Run aggregations by specifying the [search API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html)'s `aggs` parameter. Learn more in [Run an aggregation](aggregations.md#run-an-agg).
68-
69-
70-
### {{esql}} [search-analyze-data-esql]
71-
72-
[Elasticsearch Query Language ({{esql}})](query-filter/languages/esorql.md) is a piped query language for filtering, transforming, and analyzing data. {{esql}} is built on top of a new compute engine, where search, aggregation, and transformation functions are directly executed within {{es}} itself. {{esql}} syntax can also be used within various {{kib}} tools.
73-
74-
The [`_query` endpoint](query-filter/languages/esql-rest.md) accepts queries written in {{esql}} syntax.
75-
76-
Today, it supports a subset of the features available in Query DSL, but it is rapidly evolving.
12+
You’ll use a combination of an API endpoint and a query language to interact with your data.
7713

78-
It comes with a comprehensive set of [functions and operators](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-functions-operators.html) for working with data and has robust integration with {{kib}}'s Discover, dashboards and visualizations.
14+
- Elasticsearch provides a number of [query languages](/explore-analyze/query-filter/languages.md). From Query DSL to the newest ES|QL, find the one that's most appropriate for you.
7915

80-
Learn more in [Getting started with {{esql}}](../solutions/search/get-started.md), or try [our training course](https://www.elastic.co/training/introduction-to-esql).
16+
- You can call Elasticsearch's REST APIs by submitting requests directly from the command line or through the Dev Tools [Console](/explore-analyze/query-filter/tools/console.md) in {{kib}}. From your applications, you can use a [client](https://www.elastic.co/guide/en/elasticsearch/client/index.md) in your programming language of choice.
8117

18+
- A number of [tools](/explore-analyze/query-filter/tools.md) are available for you to save, debug, and optimize your queries.
8219

83-
## List of available query languages [search-analyze-data-query-languages-table]
20+
% todo: update link to the best target
21+
If you're just getting started with Elasticsearch, try the hands-on [API quickstart](/solutions/search/elasticsearch-basics-quickstart.md) to learn how to add data and run basic searches using Query DSL and the `_search` endpoint.
8422

85-
The following table summarizes all available {{es}} query languages, to help you choose the right one for your use case.
23+
## Filtering
8624

87-
| Name | Description | Use cases | API endpoint |
88-
| --- | --- | --- | --- |
89-
| [Query DSL](query-filter/languages/querydsl.md) | The primary query language for {{es}}. A powerful and flexible JSON-style language that enables complex queries. | Full-text search, semantic search, keyword search, filtering, aggregations, and more. | [`_search`](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html) |
90-
| [{{esql}}](query-filter/languages/esorql.md) | Introduced in **8.11**, the Elasticsearch Query Language ({{esql}}) is a piped query language language for filtering, transforming, and analyzing data. | Initially tailored towards working with time series data like logs and metrics.Robust integration with {{kib}} for querying, visualizing, and analyzing data.Does not yet support full-text search. | [`_query`](query-filter/languages/esql-rest.md) |
91-
| [EQL](query-filter/languages/eql.md) | Event Query Language (EQL) is a query language for event-based time series data. Data must contain the `@timestamp` field to use EQL. | Designed for the threat hunting security use case. | [`_eql`](https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-apis.html) |
92-
| [Elasticsearch SQL](query-filter/languages/sql.md) | Allows native, real-time SQL-like querying against {{es}} data. JDBC and ODBC drivers are available for integration with business intelligence (BI) tools. | Enables users familiar with SQL to query {{es}} data using familiar syntax for BI and reporting. | [`_sql`](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-apis.html) |
93-
| [Kibana Query Language (KQL)](query-filter/languages/kql.md) | {{kib}} Query Language (KQL) is a text-based query language for filtering data when you access it through the {{kib}} UI. | Use KQL to filter documents where a value for a field exists, matches a given value, or is within a given range. | N/A |
25+
When querying your data in Kibana, additional options let you filter the results to just the subset you need. Some of these options are common to most Elastic apps. Check [Filtering in Kibana](/explore-analyze/query-filter/filtering.md) for more details on how to recognize and use them in the UI.
9426

explore-analyze/query-filter/filtering.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ Some apps provide more options, such as [Dashboards](../dashboards.md).
2525

2626
Display data within a specified time range when your index contains time-based events, and a time-field is configured for the selected [{{data-source}}](../find-and-organize/data-views.md). The default time range is 15 minutes, but you can customize it in [Advanced Settings](https://www.elastic.co/guide/en/kibana/current/advanced-options.html).
2727

28-
1. Click ![calendar icon](../../images/kibana-time-filter-icon.png).
28+
1. Click ![calendar icon](../../../images/kibana-time-filter-icon.png).
2929
2. Choose one of the following:
3030

3131
* **Quick select**. Set a time based on the last or next number of seconds, minutes, hours, or other time unit.
3232
* **Commonly used**. Select a time range from options such as **Last 15 minutes**, **Today**, and **Week to date**.
3333
* **Recently used date ranges**. Use a previously selected data range.
3434
* **Refresh every**. Specify an automatic refresh rate.
35-
36-
:::{image} ../../../images/kibana-time-filter.png
37-
:alt: Time filter menu
38-
:width: 300px
39-
:::
35+
36+
:::{image} ../../images/kibana-time-filter.png
37+
:alt: Time filter menu
38+
:width: 300px
39+
:::
4040

4141
3. To set start and end times, click the bar next to the time filter. In the popup, select **Absolute**, **Relative** or **Now**, then specify the required options.
42-
43-
:::{image} ../../../images/kibana-time-relative.png
44-
:alt: Time filter showing relative time
45-
:class: screenshot
46-
:::
42+
43+
:::{image} ../../images/kibana-time-relative.png
44+
:alt: Time filter showing relative time
45+
:width: 350px
46+
:::
4747

4848
The global time filter limits the time range of data displayed. In most cases, the time filter applies to the time field in the data view, but some apps allow you to use a different time field.
4949

@@ -55,4 +55,4 @@ To manually resubmit a search, click the **Refresh** button. This is useful when
5555

5656
Structured filters are a more interactive way to create {{es}} queries, and are commonly used when building dashboards that are shared by multiple analysts. Each filter can be disabled, inverted, or pinned across all apps. Each of the structured filters is combined with AND logic on the rest of the query.
5757

58-
![Add filter popup](../../images/kibana-add-filter-popup.png "")
58+
![Add filter popup](../../../images/kibana-add-filter-popup.png "")

0 commit comments

Comments
 (0)