@@ -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
----
@@ -333,4 +388,129 @@ the https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in ascending order.
333
388
}
334
389
}
335
390
----
336
- // TESTRESPONSE[s/"took": 6/"took": $body.took/]
391
+ // TESTRESPONSE[s/"took": 6/"took": $body.took/]
392
+
393
+ [[eql-search-api-sequence-ex]]
394
+ ==== Sequence query example
395
+
396
+ The following EQL search request matches a <<eql-sequences,sequence>> of events
397
+ that:
398
+
399
+ . Start with an event with:
400
+ +
401
+ --
402
+ * An `event.category` of `file`
403
+ * A `file.name` of `cmd.exe`
404
+ * An `agent.id` other than `my_user`
405
+ --
406
+ . Followed by an event with:
407
+ +
408
+ --
409
+ * An `event.category` of `process`
410
+ * A `process.path` that contains the substring `regsvr32`
411
+ --
412
+
413
+ These events must also share the same `agent.id` value.
414
+
415
+ [source,console]
416
+ ----
417
+ GET my_index/_eql/search
418
+ {
419
+ "query": """
420
+ sequence by agent.id
421
+ [ file where file.name == "cmd.exe" and agent.id != "my_user" ]
422
+ [ process where stringContains(process.path, "regsvr32") ]
423
+ """
424
+ }
425
+ ----
426
+
427
+ The API returns the following response. The `hits.sequences.join_keys` property
428
+ contains the shared `agent.id` value for each matching event. Matching events in
429
+ the `hits.sequences.events` property are sorted by
430
+ <<eql-search-api-timestamp-field,timestamp>>, converted to milliseconds since
431
+ the https://en.wikipedia.org/wiki/Unix_time[Unix epoch], in ascending order.
432
+
433
+ [source,console-result]
434
+ ----
435
+ {
436
+ "took": 6,
437
+ "timed_out": false,
438
+ "hits": {
439
+ "total": {
440
+ "value": 1,
441
+ "relation": "eq"
442
+ },
443
+ "sequences": [
444
+ {
445
+ "join_keys": [
446
+ "8a4f500d"
447
+ ],
448
+ "events": [
449
+ {
450
+ "_index": "my_index",
451
+ "_type": "_doc",
452
+ "_id": "4",
453
+ "_score": null,
454
+ "_source": {
455
+ "@timestamp": "2020-12-07T11:07:08.000Z",
456
+ "agent": {
457
+ "id": "8a4f500d"
458
+ },
459
+ "event": {
460
+ "category": "file"
461
+ },
462
+ "file": {
463
+ "accessed": "2020-12-07T11:07:08.000Z",
464
+ "name": "cmd.exe",
465
+ "path": "C:\\Windows\\System32\\cmd.exe",
466
+ "type": "file",
467
+ "size": 16384
468
+ },
469
+ "process": {
470
+ "name": "cmd.exe",
471
+ "path": "C:\\Windows\\System32\\cmd.exe"
472
+ }
473
+ },
474
+ "fields": {
475
+ "@timestamp": [
476
+ "1607339228000"
477
+ ]
478
+ },
479
+ "sort": [
480
+ 1607339228000
481
+ ]
482
+ },
483
+ {
484
+ "_index": "my_index",
485
+ "_type": "_doc",
486
+ "_id": "5",
487
+ "_score": null,
488
+ "_source": {
489
+ "@timestamp": "2020-12-07T11:07:09.000Z",
490
+ "agent": {
491
+ "id": "8a4f500d"
492
+ },
493
+ "event": {
494
+ "category": "process"
495
+ },
496
+ "process": {
497
+ "name": "regsvr32.exe",
498
+ "path": "C:\\Windows\\System32\\regsvr32.exe"
499
+ }
500
+ },
501
+ "fields": {
502
+ "@timestamp": [
503
+ "1607339229000"
504
+ ]
505
+ },
506
+ "sort": [
507
+ 1607339229000
508
+ ]
509
+ }
510
+ ]
511
+ }
512
+ ]
513
+ }
514
+ }
515
+ ----
516
+ // TESTRESPONSE[s/"took": 6/"took": $body.took/]
0 commit comments