search.asciidoc 21 KB

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