@@ -168,23 +168,23 @@ If `true`, the request timed out before completion.
168
168
169
169
`hits`::
170
170
(object)
171
- Contains returned events and metadata.
171
+ Contains matching events and metadata.
172
172
+
173
173
.Properties of `hits`
174
174
[%collapsible%open]
175
175
====
176
176
177
177
`total`::
178
178
(object)
179
- Metadata about the number of returned events.
179
+ Metadata about the number of matching events.
180
180
+
181
181
.Properties of `total`
182
182
[%collapsible%open]
183
183
=====
184
184
185
185
`value`::
186
186
(integer)
187
- Total number of returned events.
187
+ Total number of matching events.
188
188
189
189
`relation`::
190
190
+
@@ -199,29 +199,80 @@ Returned values are:
199
199
--
200
200
=====
201
201
202
+ `sequences`::
203
+ (array of objects)
204
+ Contains event sequences matching the query. Each object represents a
205
+ matching sequence. This parameter is only returned for EQL queries containing
206
+ a <<eql-sequences,sequence>>.
207
+ +
208
+ .Properties of `sequences` objects
209
+ [%collapsible%open]
210
+ =====
211
+ `join_keys`::
212
+ (array of strings)
213
+ Shared field values used to constrain matches in the sequence. These are defined
214
+ using the <<eql-sequences,`by` keyword>> in the EQL query syntax.
215
+
202
216
`events`::
203
217
(array of objects)
204
- Contains returned events matching the query. Each object represents a
218
+ Contains events matching the query. Each object represents a
205
219
matching event.
206
220
+
207
221
.Properties of `events` objects
208
222
[%collapsible%open]
223
+ ======
224
+ `_index`::
225
+ (string)
226
+ Name of the index containing the event.
227
+
228
+ `_id`::
229
+ (string)
230
+ (string)
231
+ Unique identifier for the event.
232
+ This ID is only unique within the index.
233
+
234
+ `_score`::
235
+ (float)
236
+ Positive 32-bit floating point number used to determine the relevance of the
237
+ event. See <<relevance-scores>>.
238
+
239
+ `_source`::
240
+ (object)
241
+ Original JSON body passed for the event at index time.
242
+
243
+ `sort`::
244
+ (array)
245
+ Integer used as the sort value for the event.
246
+ +
247
+ By default, this is the event's <<eql-search-api-timestamp-field,timestamp
248
+ value>>, converted to milliseconds since the
249
+ https://en.wikipedia.org/wiki/Unix_time[Unix epoch].
250
+ ======
209
251
=====
210
252
253
+ [[eql-search-api-response-events]]
254
+ `events`::
255
+ (array of objects)
256
+ Contains events matching the query. Each object represents a
257
+ matching event.
258
+ +
259
+ .Properties of `events` objects
260
+ [%collapsible%open]
261
+ =====
211
262
`_index`::
212
263
(string)
213
- Name of the index containing the returned event.
264
+ Name of the index containing the event.
214
265
215
266
`_id`::
216
267
(string)
217
268
(string)
218
- Unique identifier for the returned event.
219
- This ID is only unique within the returned index.
269
+ Unique identifier for the event.
270
+ This ID is only unique within the index.
220
271
221
272
`_score`::
222
273
(float)
223
274
Positive 32-bit floating point number used to determine the relevance of the
224
- returned event. See <<relevance-scores>>.
275
+ event. See <<relevance-scores>>.
225
276
226
277
`_source`::
227
278
(object)
@@ -240,11 +291,14 @@ https://en.wikipedia.org/wiki/Unix_time[Unix epoch].
240
291
[[eql-search-api-example]]
241
292
==== {api-examples-title}
242
293
294
+ [[eql-search-api-basic-query-ex]]
295
+ ==== Basic query example
296
+
243
297
The following EQL search request searches for events with an `event.category` of
244
298
`file` that meet the following conditions:
245
299
246
300
* A `file.name` of `cmd.exe`
247
- * An `agent.id` that is _not_ `my_user`
301
+ * An `agent.id` other than `my_user`
248
302
249
303
[source,console]
250
304
----
@@ -256,9 +310,10 @@ GET my_index/_eql/search
256
310
}
257
311
----
258
312
259
- The API returns the following response. Events in the response are sorted by
260
- <<eql-search-api-timestamp-field,timestamp>>, converted to milliseconds since
261
- the https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in ascending order.
313
+ The API returns the following response. Matching events in the `hits.events`
314
+ property are sorted by <<eql-search-api-timestamp-field,timestamp>>, converted
315
+ to milliseconds since the https://en.wikipedia.org/wiki/Unix_time[Unix epoch],
316
+ in ascending order.
262
317
263
318
[source,console-result]
264
319
----
@@ -331,4 +386,127 @@ the https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in ascending order.
331
386
}
332
387
}
333
388
----
334
- // TESTRESPONSE[s/"took": 6/"took": $body.took/]
389
+ // TESTRESPONSE[s/"took": 6/"took": $body.took/]
390
+
391
+ [[eql-search-api-sequence-ex]]
392
+ ==== Sequence query example
393
+
394
+ The following EQL search request matches a <<eql-sequences,sequence>> of events
395
+ that:
396
+
397
+ . Start with an event with:
398
+ +
399
+ --
400
+ * An `event.category` of `file`
401
+ * A `file.name` of `cmd.exe`
402
+ * An `agent.id` other than `my_user`
403
+ --
404
+ . Followed by an event with:
405
+ +
406
+ --
407
+ * An `event.category` of `process`
408
+ * A `process.path` that contains the substring `regsvr32`
409
+ --
410
+
411
+ These events must also share the same `agent.id` value.
412
+
413
+ [source,console]
414
+ ----
415
+ GET my_index/_eql/search
416
+ {
417
+ "query": """
418
+ sequence by agent.id
419
+ [ file where file.name == "cmd.exe" and agent.id != "my_user" ]
420
+ [ process where stringContains(process.path, "regsvr32") ]
421
+ """
422
+ }
423
+ ----
424
+
425
+ The API returns the following response. The `hits.sequences.join_keys` property
426
+ contains the shared `agent.id` value for each matching event. Matching events in
427
+ the `hits.sequences.events` property are sorted by
428
+ <<eql-search-api-timestamp-field,timestamp>>, converted to milliseconds since
429
+ the https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in ascending order.
430
+
431
+ [source,console-result]
432
+ ----
433
+ {
434
+ "took": 6,
435
+ "timed_out": false,
436
+ "hits": {
437
+ "total": {
438
+ "value": 1,
439
+ "relation": "eq"
440
+ },
441
+ "sequences": [
442
+ {
443
+ "join_keys": [
444
+ "8a4f500d"
445
+ ],
446
+ "events": [
447
+ {
448
+ "_index": "my_index",
449
+ "_id": "4",
450
+ "_score": null,
451
+ "_source": {
452
+ "@timestamp": "2020-12-07T11:07:08.000Z",
453
+ "agent": {
454
+ "id": "8a4f500d"
455
+ },
456
+ "event": {
457
+ "category": "file"
458
+ },
459
+ "file": {
460
+ "accessed": "2020-12-07T11:07:08.000Z",
461
+ "name": "cmd.exe",
462
+ "path": "C:\\Windows\\System32\\cmd.exe",
463
+ "type": "file",
464
+ "size": 16384
465
+ },
466
+ "process": {
467
+ "name": "cmd.exe",
468
+ "path": "C:\\Windows\\System32\\cmd.exe"
469
+ }
470
+ },
471
+ "fields": {
472
+ "@timestamp": [
473
+ "1607339228000"
474
+ ]
475
+ },
476
+ "sort": [
477
+ 1607339228000
478
+ ]
479
+ },
480
+ {
481
+ "_index": "my_index",
482
+ "_id": "5",
483
+ "_score": null,
484
+ "_source": {
485
+ "@timestamp": "2020-12-07T11:07:09.000Z",
486
+ "agent": {
487
+ "id": "8a4f500d"
488
+ },
489
+ "event": {
490
+ "category": "process"
491
+ },
492
+ "process": {
493
+ "name": "regsvr32.exe",
494
+ "path": "C:\\Windows\\System32\\regsvr32.exe"
495
+ }
496
+ },
497
+ "fields": {
498
+ "@timestamp": [
499
+ "1607339229000"
500
+ ]
501
+ },
502
+ "sort": [
503
+ 1607339229000
504
+ ]
505
+ }
506
+ ]
507
+ }
508
+ ]
509
+ }
510
+ }
511
+ ----
512
+ // TESTRESPONSE[s/"took": 6/"took": $body.took/]
0 commit comments