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
* ESQL and DSL executors are introduced. param can accept ES|QL query shape now. is introduced for initial step but needs team's feedback. DSL logics moved into DSL executors.
* Apply suggestions from code review
Separate DSL and ESQL interface in the client.
Co-authored-by: Rye Biesemeyer <[email protected]>
* Rebase against upstream main after target support added. Separate unit test for DSL. Address comments: do not save ES version in client, add apply target method in executors, set to target if target is defined, docs update.
Co-authored-by: Rye Biesemeyer <[email protected]>
* Introduce query_type option which accepts dsl or esql to define a query shape. Remove multi-depth nested named_params and keep only top-level query_params which aligns with placeholder structure in the ES|QL.
* Separate event referenced and static valued fields at initialization of the ESQL executor.
* query_params now supports both Array and Hash types.
* Add tech preview section under ESQL.
* Place the query results based on the target specified. If not specified, first result will be set to event's top level.
* Apply suggestions from code review
Doc corrections.
Co-authored-by: João Duarte <[email protected]>
* ES|QL result mapping to event doc correction.
* Integration tests to run with credentials enabled and SSL configs.
---------
Co-authored-by: Rye Biesemeyer <[email protected]>
Co-authored-by: João Duarte <[email protected]>
For this case, the plugin creates two JSON look like objects as below and places them into the `target` field of the event if `target` is defined.
173
+
If `target` is not defined, the plugin places the _only_ first result at the root of the event.
174
+
[source, json]
175
+
[
176
+
{
177
+
"timestamp": "2025-04-10T12:00:00",
178
+
"user_id": 123,
179
+
"action": "login",
180
+
"status": {
181
+
"code": 200,
182
+
"desc": "Success"
183
+
}
184
+
},
185
+
{
186
+
"timestamp": "2025-04-10T12:05:00",
187
+
"user_id": 456,
188
+
"action": "purchase",
189
+
"status": {
190
+
"code": 403,
191
+
"desc": "Forbidden (unauthorized user)"
192
+
}
193
+
}
194
+
]
195
+
196
+
NOTE: If your index has a mapping with sub-objects where `status.code` and `status.desc` actually dotted fields, they appear in {ls} events as a nested structure.
197
+
198
+
[id="plugins-{type}s-{plugin}-esql-multifields"]
199
+
===== Conflict on multi-fields
200
+
201
+
{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].
202
+
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.
203
+
We recommend using the `RENAME` (or `DROP` to avoid warning) keyword in your {esql} query explicitly rename the fields to include sub-fields into the event.
204
+
205
+
This is a common occurrence if your template or mapping follows the pattern of always indexing strings as "text" (`field`) + " keyword" (`field.keyword`) multi-field.
206
+
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`.
207
+
208
+
To illustrate the situation with example, assuming your mapping has a time `time` field with `time.min` and `time.max` sub-fields as following:
209
+
[source, ruby]
210
+
"properties": {
211
+
"time": { "type": "long" },
212
+
"time.min": { "type": "long" },
213
+
"time.max": { "type": "long" }
214
+
}
215
+
216
+
The {esql} result will contain all three fields but the plugin cannot map them into {ls} event.
217
+
To avoid this, you can use the `RENAME` keyword to rename the `time` parent field to get all three fields with unique fields.
218
+
[source, ruby]
219
+
...
220
+
query => 'FROM my-index | RENAME time AS time.current'
221
+
...
222
+
223
+
For comprehensive ES|QL syntax reference and best practices, see the https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-syntax.html[{esql} documentation].
224
+
121
225
[id="plugins-{type}s-{plugin}-options"]
122
226
==== Elasticsearch Filter Configuration Options
123
227
@@ -143,6 +247,8 @@ NOTE: As of version `4.0.0` of this plugin, a number of previously deprecated se
The accepted query shape is DSL query string or ES|QL.
450
+
For the DSL query string, use either `query` or `query_template`.
451
+
Read the {ref}/query-dsl-query-string-query.html[{es} query
452
+
string documentation] or {ref}/esql.html[{es} ES|QL documentation] for more information.
453
+
454
+
[id="plugins-{type}s-{plugin}-query_type"]
455
+
===== `query_type`
456
+
457
+
* Value can be `dsl` or `esql`
458
+
* Default value is `dsl`
459
+
460
+
Defines the <<plugins-{type}s-{plugin}-query>> shape.
461
+
When `dsl`, the query shape must be valid {es} JSON-style string.
462
+
When `esql`, the query shape must be a valid {esql} string and `index`, `query_template` and `sort` parameters are not allowed.
463
+
464
+
[id="plugins-{type}s-{plugin}-query_params"]
465
+
===== `query_params`
466
+
467
+
* The value type is <<hash,hash>> or <<array,array>>. When an array provided, the array elements are pairs of `key` and `value`.
468
+
* There is no default value for this setting
346
469
470
+
Named parameters in {esql} to send to {es} together with <<plugins-{type}s-{plugin}-query>>.
471
+
Visit {ref}/esql-rest.html#esql-rest-params[passing parameters to query page] for more information.
347
472
348
473
[id="plugins-{type}s-{plugin}-query_template"]
349
474
===== `query_template`
@@ -540,8 +665,9 @@ Tags the event on failure to look up previous log event information. This can be
540
665
541
666
Define the target field for placing the result data.
542
667
If this setting is omitted, the target will be the root (top level) of the event.
668
+
It is highly recommended to set when using `query_type=>'esql'` to set all query results into the event.
543
669
544
-
The destination fields specified in <<plugins-{type}s-{plugin}-fields>>, <<plugins-{type}s-{plugin}-aggregation_fields>>, and <<plugins-{type}s-{plugin}-docinfo_fields>> are relative to this target.
670
+
When `query_type=>'dsl'`, the destination fields specified in <<plugins-{type}s-{plugin}-fields>>, <<plugins-{type}s-{plugin}-aggregation_fields>>, and <<plugins-{type}s-{plugin}-docinfo_fields>> are relative to this target.
545
671
546
672
For example, if you want the data to be put in the `operation` field:
0 commit comments