You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index.asciidoc
+27-19Lines changed: 27 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,23 +231,23 @@ The next scheduled run:
231
231
* updates the value of the field at the end of the pagination.
232
232
233
233
[id="plugins-{type}s-{plugin}-esql"]
234
-
==== ES|QL support
235
-
{es} Query Language (ES|QL) provides a SQL-like interface for querying your {es} data.
234
+
==== {esql} support
235
+
{es} Query Language ({esql}) provides a SQL-like interface for querying your {es} data.
236
236
237
237
To use {esql}, this plugin needs to be installed in {ls} 8.17.4 or newer, and must be connected to {es} 8.11 or newer.
238
238
239
-
To configure {esql} query in the plugin, set the `response_type` to `esql` and provide your {esql} query in the `query` parameter.
239
+
To configure {esql} query in the plugin, set the `query_type` to `esql` and provide your {esql} query in the `query` parameter.
240
240
241
241
IMPORTANT: {esql} is evolving and may still have limitations with regard to result size or supported field types. We recommend understanding https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-limitations.html[ES|QL current limitations] before using it in production environments.
242
242
243
-
The following is a basic scheduled ES|QL query that runs hourly:
243
+
The following is a basic scheduled {esql} query that runs hourly:
244
244
[source, ruby]
245
245
input {
246
246
elasticsearch {
247
247
id => hourly_cron_job
248
248
hosts => [ 'https://..']
249
249
api_key => '....'
250
-
response_type => 'esql'
250
+
query_type => 'esql'
251
251
query => '
252
252
FROM food-index
253
253
| WHERE spicy_level = "hot" AND @timestamp > NOW() - 1 hour
@@ -259,11 +259,11 @@ The following is a basic scheduled ES|QL query that runs hourly:
259
259
260
260
Set `config.support_escapes: true` in `logstash.yml` if you need to escape special chars in the query.
261
261
262
-
NOTE: With ES|QL query, {ls} doesn't generate `event.original`.
262
+
NOTE: With {esql} query, {ls} doesn't generate `event.original`.
ES|QL returns query results in a structured tabular format, where data is organized into _columns_ (fields) and _values_ (entries).
265
+
===== Mapping {esql} result to {ls} event
266
+
{esql} returns query results in a structured tabular format, where data is organized into _columns_ (fields) and _values_ (entries).
267
267
The plugin maps each value entry to an event, populating corresponding fields.
268
268
For example, a query might produce a table like:
269
269
@@ -303,9 +303,9 @@ NOTE: If your index has a mapping with sub-objects where `status.code` and `stat
303
303
[id="plugins-{type}s-{plugin}-esql-multifields"]
304
304
===== Conflict on multi-fields
305
305
306
-
ES|QL query fetches all parent and sub-fields fields if your {es} index has https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/multi-fields[multi-fields] or https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/subobjects[subobjects].
306
+
{esql} query fetches all parent and sub-fields fields if your {es} index has https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/multi-fields[multi-fields] or https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/subobjects[subobjects].
307
307
Since {ls} events cannot contain parent field's concrete value and sub-field values together, the plugin ignores sub-fields with warning and includes parent.
308
-
We recommend using the `RENAME` (or `DROP` to avoid warnings) keyword in your ES|QL query explicitly rename the fields to include sub-fields into the event.
308
+
We recommend using the `RENAME` (or `DROP` to avoid warnings) keyword in your {esql} query explicitly rename the fields to include sub-fields into the event.
309
309
310
310
This a common occurrence if your template or mapping follows the pattern of always indexing strings as "text" (`field`) + " keyword" (`field.keyword`) multi-field.
311
311
In this case it's recommended to do `KEEP field` if the string is identical and there is only one subfield as the engine will optimize and retrieve the keyword, otherwise you can do `KEEP field.keyword | RENAME field.keyword as field`.
@@ -318,14 +318,14 @@ To illustrate the situation with example, assuming your mapping has a time `time
318
318
"time.max": { "type": "long" }
319
319
}
320
320
321
-
The ES|QL result will contain all three fields but the plugin cannot map them into {ls} event.
321
+
The {esql} result will contain all three fields but the plugin cannot map them into {ls} event.
322
322
To avoid this, you can use the `RENAME` keyword to rename the `time` parent field to get all three fields with unique fields.
323
323
[source, ruby]
324
324
...
325
325
query => 'FROM my-index | RENAME time AS time.current'
326
326
...
327
327
328
-
For comprehensive ES|QL syntax reference and best practices, see the https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-syntax.html[{es} ES|QL documentation].
328
+
For comprehensive {esql} syntax reference and best practices, see the https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-syntax.html[{esql} documentation].
329
329
330
330
[id="plugins-{type}s-{plugin}-options"]
331
331
==== Elasticsearch Input configuration options
@@ -354,7 +354,8 @@ Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.
@@ -596,12 +597,22 @@ environment variables e.g. `proxy => '${LS_PROXY:}'`.
596
597
* Default value is `'{ "sort": [ "_doc" ] }'`
597
598
598
599
The query to be executed.
599
-
Accepted query shape is DSL or ES|QL (when `response_type => 'esql'`).
600
-
Read the {ref}/query-dsl.html[{es} query DSL documentation] or {ref}/esql.html[{es} ES|QL documentation] for more information.
600
+
Accepted query shape is DSL or {esql} (when `query_type => 'esql'`).
601
+
Read the {ref}/query-dsl.html[{es} query DSL documentation] or {ref}/esql.html[{esql} documentation] for more information.
601
602
602
603
When <<plugins-{type}s-{plugin}-search_api>> resolves to `search_after` and the query does not specify `sort`,
603
604
the default sort `'{ "sort": { "_shard_doc": "asc" } }'` will be added to the query. Please refer to the {ref}/paginate-search-results.html#search-after[Elasticsearch search_after] parameter to know more.
604
605
606
+
[id="plugins-{type}s-{plugin}-query_type"]
607
+
===== `query_type`
608
+
609
+
* Value can be `dsl` or `esql`
610
+
* Default value is `dsl`
611
+
612
+
Defines the <<plugins-{type}s-{plugin}-query>> shape.
613
+
When `dsl`, the query shape must be valid {es} JSON-style string.
614
+
When `esql`, the query shape must be a valid {esql} string and `index`, `size`, `slices`, `search_api`, `docinfo`, `docinfo_target`, `docinfo_fields`, `response_type` and `tracking_field` parameters are not allowed.
615
+
605
616
[id="plugins-{type}s-{plugin}-response_type"]
606
617
===== `response_type`
607
618
@@ -613,14 +624,11 @@ response from the query.
613
624
614
625
The default `hits` will generate one event per returned document (i.e. "hit").
615
626
616
-
When set to `aggregations`, a single Logstash event will be generated with the
627
+
When set to `aggregations`, a single {ls} event will be generated with the
617
628
contents of the `aggregations` object of the query's response. In this case the
618
629
`hits` object will be ignored. The parameter `size` will be always be set to
619
630
0 regardless of the default or user-defined value set in this plugin.
620
631
621
-
When using the `esql` setting, the query must be a valid ES|QL string.
622
-
When this setting is active, `index`, `size`, `slices`, `search_api`, `docinfo`, `docinfo_target` and `docinfo_fields` parameters are not allowed.
fail("Connected Elasticsearch #{es_version} version does not supports ES|QL. ES|QL feature requires at least Elasticsearch #{ES_ESQL_SUPPORT_VERSION} version.")unlesses_supports_esql
0 commit comments