eql.asciidoc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[eql]]
  4. = EQL search
  5. ++++
  6. <titleabbrev>EQL</titleabbrev>
  7. ++++
  8. experimental::[]
  9. {eql-ref}/index.html[Event Query Language (EQL)] is a query language for
  10. event-based, time series data, such as logs.
  11. [discrete]
  12. [[eql-advantages]]
  13. == Advantages of EQL
  14. * *EQL lets you express relationships between events.* +
  15. Many query languages allow you to match only single events. EQL lets you match a
  16. sequence of events across different event categories and time spans.
  17. * *EQL has a low learning curve.* +
  18. EQL syntax looks like other query languages. It lets you write and read queries
  19. intuitively, which makes for quick, iterative searching.
  20. * *We designed EQL for security use cases.* +
  21. While you can use EQL for any event-based data, we created EQL for threat
  22. hunting. EQL not only supports indicator of compromise (IOC) searching but
  23. makes it easy to describe activity that goes beyond IOCs.
  24. [discrete]
  25. [[eql-required-fields]]
  26. == Required fields
  27. TIP: While no schema is required to use EQL in {es}, we recommend using the
  28. {ecs-ref}[Elastic Common Schema (ECS)]. EQL search is designed to work
  29. with core ECS fields by default.
  30. EQL assumes each document in a data stream or index corresponds to an event. To
  31. run an EQL search, each document must contain a _timestamp_ and _event category_
  32. field.
  33. EQL uses the `@timestamp` and `event.category` fields from the {ecs-ref}[ECS] as
  34. the default timestamp and event category fields. If your documents use a
  35. different timestamp or event category field, you must specify it in the search
  36. request. See <<specify-a-timestamp-or-event-category-field>>.
  37. [discrete]
  38. [[run-an-eql-search]]
  39. == Run an EQL search
  40. You can use the <<eql-search-api,EQL search API>> to run an EQL search.
  41. The following request searches `my-index-000001` for events with an
  42. `event.category` of `process` and a `process.name` of `regsvr32.exe`. Each
  43. document in `my-index-000001` includes a `@timestamp` and `event.category`
  44. field.
  45. [source,console]
  46. ----
  47. GET /my-index-000001/_eql/search
  48. {
  49. "query": """
  50. process where process.name == "regsvr32.exe"
  51. """
  52. }
  53. ----
  54. // TEST[setup:sec_logs]
  55. The API returns the following response. Matching events are included in the
  56. `hits.events` property. These events are sorted by timestamp, converted to
  57. milliseconds since the {wikipedia}/Unix_time[Unix epoch], in
  58. ascending order.
  59. [source,console-result]
  60. ----
  61. {
  62. "is_partial": false,
  63. "is_running": false,
  64. "took": 60,
  65. "timed_out": false,
  66. "hits": {
  67. "total": {
  68. "value": 2,
  69. "relation": "eq"
  70. },
  71. "events": [
  72. {
  73. "_index": "my-index-000001",
  74. "_id": "OQmfCaduce8zoHT93o4H",
  75. "_source": {
  76. "@timestamp": "2099-12-07T11:07:09.000Z",
  77. "event": {
  78. "category": "process",
  79. "id": "aR3NWVOs",
  80. "sequence": 4
  81. },
  82. "process": {
  83. "pid": 2012,
  84. "name": "regsvr32.exe",
  85. "command_line": "regsvr32.exe /s /u /i:https://...RegSvr32.sct scrobj.dll",
  86. "executable": "C:\\Windows\\System32\\regsvr32.exe"
  87. }
  88. }
  89. },
  90. {
  91. "_index": "my-index-000001",
  92. "_id": "xLkCaj4EujzdNSxfYLbO",
  93. "_source": {
  94. "@timestamp": "2099-12-07T11:07:10.000Z",
  95. "event": {
  96. "category": "process",
  97. "id": "GTSmSqgz0U",
  98. "sequence": 6,
  99. "type": "termination"
  100. },
  101. "process": {
  102. "pid": 2012,
  103. "name": "regsvr32.exe",
  104. "executable": "C:\\Windows\\System32\\regsvr32.exe"
  105. }
  106. }
  107. }
  108. ]
  109. }
  110. }
  111. ----
  112. // TESTRESPONSE[s/"took": 60/"took": $body.took/]
  113. // TESTRESPONSE[s/"_id": "OQmfCaduce8zoHT93o4H"/"_id": $body.hits.events.0._id/]
  114. // TESTRESPONSE[s/"_id": "xLkCaj4EujzdNSxfYLbO"/"_id": $body.hits.events.1._id/]
  115. [discrete]
  116. [[eql-search-sequence]]
  117. === Search for a sequence of events
  118. You can use EQL's <<eql-sequences,sequence syntax>> to search for an ordered
  119. series of events.
  120. The following EQL search request matches a sequence that:
  121. . Starts with an event with:
  122. +
  123. --
  124. * An `event.category` of `process`
  125. * A `process.name` of `regsvr32.exe`
  126. --
  127. . Followed by an event with:
  128. +
  129. --
  130. * An `event.category` of `file`
  131. * A `file.name` that contains the substring `scrobj.dll`
  132. --
  133. [source,console]
  134. ----
  135. GET /my-index-000001/_eql/search
  136. {
  137. "query": """
  138. sequence
  139. [ process where process.name == "regsvr32.exe" ]
  140. [ file where stringContains(file.name, "scrobj.dll") ]
  141. """
  142. }
  143. ----
  144. // TEST[setup:sec_logs]
  145. The API returns the following response. Matching sequences are included in the
  146. `hits.sequences` property.
  147. [source,console-result]
  148. ----
  149. {
  150. "is_partial": false,
  151. "is_running": false,
  152. "took": 60,
  153. "timed_out": false,
  154. "hits": {
  155. "total": {
  156. "value": 1,
  157. "relation": "eq"
  158. },
  159. "sequences": [
  160. {
  161. "events": [
  162. {
  163. "_index": "my-index-000001",
  164. "_id": "OQmfCaduce8zoHT93o4H",
  165. "_source": {
  166. "@timestamp": "2099-12-07T11:07:09.000Z",
  167. "event": {
  168. "category": "process",
  169. "id": "aR3NWVOs",
  170. "sequence": 4
  171. },
  172. "process": {
  173. "pid": 2012,
  174. "name": "regsvr32.exe",
  175. "command_line": "regsvr32.exe /s /u /i:https://...RegSvr32.sct scrobj.dll",
  176. "executable": "C:\\Windows\\System32\\regsvr32.exe"
  177. }
  178. }
  179. },
  180. {
  181. "_index": "my-index-000001",
  182. "_id": "yDwnGIJouOYGBzP0ZE9n",
  183. "_source": {
  184. "@timestamp": "2099-12-07T11:07:10.000Z",
  185. "event": {
  186. "category": "file",
  187. "id": "tZ1NWVOs",
  188. "sequence": 5
  189. },
  190. "process": {
  191. "pid": 2012,
  192. "name": "regsvr32.exe",
  193. "executable": "C:\\Windows\\System32\\regsvr32.exe"
  194. },
  195. "file": {
  196. "path": "C:\\Windows\\System32\\scrobj.dll",
  197. "name": "scrobj.dll"
  198. }
  199. }
  200. }
  201. ]
  202. }
  203. ]
  204. }
  205. }
  206. ----
  207. // TESTRESPONSE[s/"took": 60/"took": $body.took/]
  208. // TESTRESPONSE[s/"_id": "OQmfCaduce8zoHT93o4H"/"_id": $body.hits.sequences.0.events.0._id/]
  209. // TESTRESPONSE[s/"_id": "yDwnGIJouOYGBzP0ZE9n"/"_id": $body.hits.sequences.0.events.1._id/]
  210. You can use the <<eql-with-maxspan-keywords,`with maxspan` keywords>> to
  211. constrain a sequence to a specified timespan.
  212. The following EQL search request adds `with maxspan=1h` to the previous query.
  213. This ensures all events in a matching sequence occur within `1h` (one hour) of
  214. the first event's timestamp.
  215. [source,console]
  216. ----
  217. GET /my-index-000001/_eql/search
  218. {
  219. "query": """
  220. sequence with maxspan=1h
  221. [ process where process.name == "regsvr32.exe" ]
  222. [ file where stringContains(file.name, "scrobj.dll") ]
  223. """
  224. }
  225. ----
  226. // TEST[setup:sec_logs]
  227. You can further constrain matching event sequences using the
  228. <<eql-by-keyword,`by` keyword>>.
  229. The following EQL search request adds `by process.pid` to each event item. This
  230. ensures events matching the sequence share the same `process.pid` field value.
  231. [source,console]
  232. ----
  233. GET /my-index-000001/_eql/search
  234. {
  235. "query": """
  236. sequence with maxspan=1h
  237. [ process where process.name == "regsvr32.exe" ] by process.pid
  238. [ file where stringContains(file.name, "scrobj.dll") ] by process.pid
  239. """
  240. }
  241. ----
  242. // TEST[setup:sec_logs]
  243. Because the `process.pid` field is shared across all events in the sequence, it
  244. can be included using `sequence by`. The following query is equivalent to the
  245. previous one.
  246. [source,console]
  247. ----
  248. GET /my-index-000001/_eql/search
  249. {
  250. "query": """
  251. sequence by process.pid with maxspan=1h
  252. [ process where process.name == "regsvr32.exe" ]
  253. [ file where stringContains(file.name, "scrobj.dll") ]
  254. """
  255. }
  256. ----
  257. // TEST[setup:sec_logs]
  258. The API returns the following response. The `hits.sequences.join_keys` property
  259. contains the shared `process.pid` value for each matching event.
  260. [source,console-result]
  261. ----
  262. {
  263. "is_partial": false,
  264. "is_running": false,
  265. "took": 60,
  266. "timed_out": false,
  267. "hits": {
  268. "total": {
  269. "value": 1,
  270. "relation": "eq"
  271. },
  272. "sequences": [
  273. {
  274. "join_keys": [
  275. 2012
  276. ],
  277. "events": [
  278. {
  279. "_index": "my-index-000001",
  280. "_id": "OQmfCaduce8zoHT93o4H",
  281. "_source": {
  282. "@timestamp": "2099-12-07T11:07:09.000Z",
  283. "event": {
  284. "category": "process",
  285. "id": "aR3NWVOs",
  286. "sequence": 4
  287. },
  288. "process": {
  289. "pid": 2012,
  290. "name": "regsvr32.exe",
  291. "command_line": "regsvr32.exe /s /u /i:https://...RegSvr32.sct scrobj.dll",
  292. "executable": "C:\\Windows\\System32\\regsvr32.exe"
  293. }
  294. }
  295. },
  296. {
  297. "_index": "my-index-000001",
  298. "_id": "yDwnGIJouOYGBzP0ZE9n",
  299. "_source": {
  300. "@timestamp": "2099-12-07T11:07:10.000Z",
  301. "event": {
  302. "category": "file",
  303. "id": "tZ1NWVOs",
  304. "sequence": 5
  305. },
  306. "process": {
  307. "pid": 2012,
  308. "name": "regsvr32.exe",
  309. "executable": "C:\\Windows\\System32\\regsvr32.exe"
  310. },
  311. "file": {
  312. "path": "C:\\Windows\\System32\\scrobj.dll",
  313. "name": "scrobj.dll"
  314. }
  315. }
  316. }
  317. ]
  318. }
  319. ]
  320. }
  321. }
  322. ----
  323. // TESTRESPONSE[s/"took": 60/"took": $body.took/]
  324. // TESTRESPONSE[s/"_id": "OQmfCaduce8zoHT93o4H"/"_id": $body.hits.sequences.0.events.0._id/]
  325. // TESTRESPONSE[s/"_id": "yDwnGIJouOYGBzP0ZE9n"/"_id": $body.hits.sequences.0.events.1._id/]
  326. You can use the <<eql-until-keyword,`until` keyword>> to specify an expiration
  327. event for sequences. Matching sequences must end before this event.
  328. The following request adds `until [ process where event.type == "termination" ]`
  329. to the previous query. This ensures matching sequences end before a `process`
  330. event with an `event.type` of `termination`.
  331. [source,console]
  332. ----
  333. GET /my-index-000001/_eql/search
  334. {
  335. "query": """
  336. sequence by process.pid with maxspan=1h
  337. [ process where process.name == "regsvr32.exe" ]
  338. [ file where stringContains(file.name, "scrobj.dll") ]
  339. until [ process where event.type == "termination" ]
  340. """
  341. }
  342. ----
  343. // TEST[setup:sec_logs]
  344. [discrete]
  345. [[specify-a-timestamp-or-event-category-field]]
  346. === Specify a timestamp or event category field
  347. To run an EQL search, each searched document must contain a timestamp and event
  348. category field. The EQL search API uses the `@timestamp` and `event.category`
  349. fields from the {ecs-ref}[Elastic Common Schema (ECS)] by default. If your
  350. documents use a different timestamp or event category field, you must specify it
  351. in the search request using the `timestamp_field` or `event_category_field`
  352. parameters.
  353. The event category field is typically mapped as a <<keyword,`keyword`>> or
  354. <<constant-keyword-field-type,constant keyword>> field. The timestamp field is typically
  355. mapped as a <<date,`date`>> or <<date_nanos,`date_nanos`>> field.
  356. NOTE: You cannot use a <<nested,`nested`>> field or the sub-fields of a `nested`
  357. field as the timestamp or event category field. See <<eql-nested-fields>>.
  358. The following request uses the `timestamp_field` parameter to specify
  359. `file.accessed` as the timestamp field. The request also uses the
  360. `event_category_field` parameter to specify `file.type` as the event category
  361. field.
  362. [source,console]
  363. ----
  364. GET /my-index-000001/_eql/search
  365. {
  366. "timestamp_field": "file.accessed",
  367. "event_category_field": "file.type",
  368. "query": """
  369. file where (file.size > 1 and file.type == "file")
  370. """
  371. }
  372. ----
  373. // TEST[setup:sec_logs]
  374. [discrete]
  375. [[eql-search-filter-query-dsl]]
  376. === Filter using query DSL
  377. You can use the `filter` parameter to specify an additional query using
  378. <<query-dsl,query DSL>>. This query filters the documents on which the EQL query
  379. runs.
  380. The following request uses a `range` query to filter `my-index-000001` to only
  381. documents with a `file.size` value greater than `1` but less than `1000000`
  382. bytes. The EQL query in `query` parameter then runs on these filtered documents.
  383. [source,console]
  384. ----
  385. GET /my-index-000001/_eql/search
  386. {
  387. "filter": {
  388. "range" : {
  389. "file.size" : {
  390. "gte" : 1,
  391. "lte" : 1000000
  392. }
  393. }
  394. },
  395. "query": """
  396. file where (file.type == "file" and file.name == "cmd.exe")
  397. """
  398. }
  399. ----
  400. // TEST[setup:sec_logs]
  401. [discrete]
  402. [[eql-search-case-sensitive]]
  403. === Run a case-sensitive EQL search
  404. By default, matching for EQL queries is case-insensitive. You can use the
  405. `case_sensitive` parameter to toggle case sensitivity on or off.
  406. The following search request contains a query that matches `process` events
  407. with a `process.executable` containing `System32`.
  408. Because `case_sensitive` is `true`, this query only matches `process.executable`
  409. values containing `System32` with the exact same capitalization. A
  410. `process.executable` value containing `system32` or `SYSTEM32` would not match
  411. this query.
  412. [source,console]
  413. ----
  414. GET /my-index-000001/_eql/search
  415. {
  416. "keep_on_completion": true,
  417. "case_sensitive": true,
  418. "query": """
  419. process where stringContains(process.executable, "System32")
  420. """
  421. }
  422. ----
  423. // TEST[setup:sec_logs]
  424. [discrete]
  425. [[eql-search-async]]
  426. === Run an async EQL search
  427. EQL searches are designed to run on large volumes of data quickly, often
  428. returning results in milliseconds. For this reason, EQL searches are
  429. _synchronous_ by default. The search request waits for complete results before
  430. returning a response.
  431. However, complete results can take longer for searches across:
  432. * <<frozen-indices,Frozen indices>>
  433. * <<modules-cross-cluster-search,Multiple clusters>>
  434. * Many shards
  435. To avoid long waits, you can use the `wait_for_completion_timeout` parameter to
  436. run an _asynchronous_, or _async_, EQL search.
  437. Set `wait_for_completion_timeout` to a duration you'd like to wait
  438. for complete search results. If the search request does not finish within this
  439. period, the search becomes async and returns a response that includes:
  440. * A search ID, which can be used to monitor the progress of the async search.
  441. * An `is_partial` value of `true`, meaning the response does not contain
  442. complete search results.
  443. * An `is_running` value of `true`, meaning the search is async and ongoing.
  444. The async search continues to run in the background without blocking
  445. other requests.
  446. The following request searches the `frozen-my-index-000001` index, which has been
  447. <<frozen-indices,frozen>> for storage and is rarely searched.
  448. Because searches on frozen indices are expected to take longer to complete, the
  449. request contains a `wait_for_completion_timeout` parameter value of `2s` (two
  450. seconds). If the request does not return complete results in two seconds, the
  451. search becomes async and returns a search ID.
  452. [source,console]
  453. ----
  454. GET /frozen-my-index-000001/_eql/search
  455. {
  456. "wait_for_completion_timeout": "2s",
  457. "query": """
  458. process where process.name == "cmd.exe"
  459. """
  460. }
  461. ----
  462. // TEST[setup:sec_logs]
  463. // TEST[s/frozen-my-index-000001/my-index-000001/]
  464. After two seconds, the request returns the following response. Note `is_partial`
  465. and `is_running` properties are `true`, indicating an async search.
  466. [source,console-result]
  467. ----
  468. {
  469. "id": "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
  470. "is_partial": true,
  471. "is_running": true,
  472. "took": 2000,
  473. "timed_out": false,
  474. "hits": ...
  475. }
  476. ----
  477. // TESTRESPONSE[s/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=/$body.id/]
  478. // TESTRESPONSE[s/"is_partial": true/"is_partial": $body.is_partial/]
  479. // TESTRESPONSE[s/"is_running": true/"is_running": $body.is_running/]
  480. // TESTRESPONSE[s/"took": 2000/"took": $body.took/]
  481. // TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
  482. You can use the the search ID and the <<get-async-eql-search-api,get async EQL
  483. search API>> to check the progress of an async search.
  484. The get async EQL search API also accepts a `wait_for_completion_timeout`
  485. parameter. If ongoing search does not complete during this period, the response
  486. returns an `is_partial` value of `true` and no search results.
  487. The following get async EQL search API request checks the progress of the
  488. previous async EQL search. The request specifies a `wait_for_completion_timeout`
  489. query parameter value of `2s` (two seconds).
  490. [source,console]
  491. ----
  492. GET /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s
  493. ----
  494. // TEST[skip: no access to search ID]
  495. The request returns the following response. Note `is_partial` and `is_running`
  496. are `false`, indicating the async search has finished and the search results
  497. in the `hits` property are complete.
  498. [source,console-result]
  499. ----
  500. {
  501. "id": "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
  502. "is_partial": false,
  503. "is_running": false,
  504. "took": 2000,
  505. "timed_out": false,
  506. "hits": ...
  507. }
  508. ----
  509. // TESTRESPONSE[s/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=/$body.id/]
  510. // TESTRESPONSE[s/"took": 2000/"took": $body.took/]
  511. // TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
  512. [discrete]
  513. [[eql-search-store-async-eql-search]]
  514. === Change the search retention period
  515. By default, the EQL search API stores async searches for five days. After this
  516. period, any searches and their results are deleted. You can use the `keep_alive`
  517. parameter to change this retention period.
  518. In the following EQL search request, the `keep_alive` parameter is `2d` (two
  519. days). If the search becomes async, its results
  520. are stored on the cluster for two days. After two days, the async
  521. search and its results are deleted, even if it's still ongoing.
  522. [source,console]
  523. ----
  524. GET /my-index-000001/_eql/search
  525. {
  526. "keep_alive": "2d",
  527. "wait_for_completion_timeout": "2s",
  528. "query": """
  529. process where process.name == "cmd.exe"
  530. """
  531. }
  532. ----
  533. // TEST[setup:sec_logs]
  534. You can use the <<get-async-eql-search-api,get async EQL search API>>'s
  535. `keep_alive`parameter to later change the retention period. The new
  536. retention period starts after the get request executes.
  537. The following request sets the `keep_alive` query parameter to `5d` (five days).
  538. The async search and its results are deleted five days after the get request
  539. executes.
  540. [source,console]
  541. ----
  542. GET /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?keep_alive=5d
  543. ----
  544. // TEST[skip: no access to search ID]
  545. You can use the <<delete-async-eql-search-api,delete async EQL search API>> to
  546. manually delete an async EQL search before the `keep_alive` period ends. If the
  547. search is still ongoing, this cancels the search request.
  548. The following request deletes an async EQL search and its results.
  549. [source,console]
  550. ----
  551. DELETE /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?keep_alive=5d
  552. ----
  553. // TEST[skip: no access to search ID]
  554. [discrete]
  555. [[eql-search-store-sync-eql-search]]
  556. === Store synchronous EQL searches
  557. By default, the EQL search API only stores async searches that cannot be
  558. completed within the period set by `wait_for_completion_timeout`.
  559. To save the results of searches that complete during this period, set the
  560. `keep_on_completion` parameter to `true`.
  561. In the following search request, `keep_on_completion` is `true`. This means the
  562. search results are stored on the cluster, even if the search completes within
  563. the `2s` (two-second) period set by the `wait_for_completion_timeout` parameter.
  564. [source,console]
  565. ----
  566. GET /my-index-000001/_eql/search
  567. {
  568. "keep_on_completion": true,
  569. "wait_for_completion_timeout": "2s",
  570. "query": """
  571. process where process.name == "cmd.exe"
  572. """
  573. }
  574. ----
  575. // TEST[setup:sec_logs]
  576. The API returns the following response. A search ID is provided in the `id`
  577. property. `is_partial` and `is_running` are `false`, indicating the EQL search
  578. was synchronous and returned complete results in `hits`.
  579. [source,console-result]
  580. ----
  581. {
  582. "id": "FjlmbndxNmJjU0RPdExBTGg0elNOOEEaQk9xSjJBQzBRMldZa1VVQ2pPa01YUToxMDY=",
  583. "is_partial": false,
  584. "is_running": false,
  585. "took": 52,
  586. "timed_out": false,
  587. "hits": ...
  588. }
  589. ----
  590. // TESTRESPONSE[s/FjlmbndxNmJjU0RPdExBTGg0elNOOEEaQk9xSjJBQzBRMldZa1VVQ2pPa01YUToxMDY=/$body.id/]
  591. // TESTRESPONSE[s/"took": 52/"took": $body.took/]
  592. // TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
  593. You can use the search ID and the <<get-async-eql-search-api,get async EQL
  594. search API>> to retrieve the same results later.
  595. [source,console]
  596. ----
  597. GET /_eql/search/FjlmbndxNmJjU0RPdExBTGg0elNOOEEaQk9xSjJBQzBRMldZa1VVQ2pPa01YUToxMDY=
  598. ----
  599. // TEST[skip: no access to search ID]
  600. Saved synchronous searches are still subject to the retention period set by the
  601. `keep_alive` parameter. After this period, the search and its results are
  602. deleted.
  603. You can also manually delete saved synchronous searches using the
  604. <<delete-async-eql-search-api,delete async EQL search API>>.
  605. include::syntax.asciidoc[]
  606. include::functions.asciidoc[]
  607. include::pipes.asciidoc[]
  608. include::detect-threats-with-eql.asciidoc[]