eql.asciidoc 19 KB

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