|
@@ -468,9 +468,8 @@ GET /sec_logs/_eql/search
|
|
|
|
|
|
EQL searches in {es} are designed to run on large volumes of data quickly,
|
|
|
often returning results in milliseconds. Because of this, the EQL search API
|
|
|
-runs _synchronous_ searches by default. This means the search request
|
|
|
-blocks other requests and waits for complete results before returning a
|
|
|
-response.
|
|
|
+runs _synchronous_ searches by default. This means the search request waits for
|
|
|
+complete results before returning a response.
|
|
|
|
|
|
However, complete results can take longer for searches across:
|
|
|
|
|
@@ -492,6 +491,7 @@ API returns a response that includes:
|
|
|
* An `is_partial` value of `true`, indicating the response does not contain
|
|
|
complete search results.
|
|
|
* An `is_running` value of `true`, indicating the search is async and ongoing.
|
|
|
+* Partial search results, if available, in the `hits` property.
|
|
|
|
|
|
The async search continues to run in the background without blocking
|
|
|
other requests.
|
|
@@ -503,7 +503,7 @@ The following request searches the `frozen_sec_logs` index, which has been
|
|
|
<<frozen-indices,frozen>> for storage and is rarely searched.
|
|
|
|
|
|
Because searches on frozen indices are expected to take longer to complete, the
|
|
|
-request contains a `wait_for_completion_timeout` query parameter value of `2s`
|
|
|
+request contains a `wait_for_completion_timeout` parameter value of `2s`
|
|
|
(two seconds).
|
|
|
|
|
|
If the request does not return complete results in two seconds, the search
|
|
@@ -520,9 +520,10 @@ GET /frozen_sec_logs/_eql/search
|
|
|
}
|
|
|
----
|
|
|
// TEST[s/frozen_sec_logs/sec_logs/]
|
|
|
-// TEST[s/"wait_for_completion_timeout": "2s"/"wait_for_completion_timeout": "2s"/]
|
|
|
|
|
|
-After two seconds, the request returns the following response.
|
|
|
+After two seconds, the request returns the following response. Note the
|
|
|
+`is_partial` and `is_running` properties are `true`, indicating an ongoing async
|
|
|
+search.
|
|
|
|
|
|
[source,console-result]
|
|
|
----
|
|
@@ -532,63 +533,56 @@ After two seconds, the request returns the following response.
|
|
|
"is_running": true,
|
|
|
"took": 2000,
|
|
|
"timed_out": false,
|
|
|
- "hits": {
|
|
|
- "total": {
|
|
|
- "value": 2,
|
|
|
- "relation": "eq"
|
|
|
- },
|
|
|
- "events": [
|
|
|
- {
|
|
|
- "_index": "frozen_sec_logs",
|
|
|
- "_id": "1",
|
|
|
- "_score": null,
|
|
|
- "_source": {
|
|
|
- "@timestamp": "2020-12-06T11:04:05.000Z",
|
|
|
- "agent": {
|
|
|
- "id": "8a4f500d"
|
|
|
- },
|
|
|
- "event": {
|
|
|
- "category": "process"
|
|
|
- },
|
|
|
- "process": {
|
|
|
- "name": "cmd.exe",
|
|
|
- "path": "C:\\Windows\\System32\\cmd.exe"
|
|
|
- }
|
|
|
- },
|
|
|
- "sort": [
|
|
|
- 1607252645000
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "_index": "frozen_sec_logs",
|
|
|
- "_id": "3",
|
|
|
- "_score": null,
|
|
|
- "_source": {
|
|
|
- "@timestamp": "2020-12-07T11:06:07.000Z",
|
|
|
- "agent": {
|
|
|
- "id": "8a4f500d"
|
|
|
- },
|
|
|
- "event": {
|
|
|
- "category": "process"
|
|
|
- },
|
|
|
- "process": {
|
|
|
- "name": "cmd.exe",
|
|
|
- "path": "C:\\Windows\\System32\\cmd.exe"
|
|
|
- }
|
|
|
- },
|
|
|
- "sort": [
|
|
|
- 1607339167000
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
+ "hits": ...
|
|
|
}
|
|
|
----
|
|
|
// TESTRESPONSE[s/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=/$body.id/]
|
|
|
// TESTRESPONSE[s/"is_partial": true/"is_partial": $body.is_partial/]
|
|
|
// TESTRESPONSE[s/"is_running": true/"is_running": $body.is_running/]
|
|
|
// TESTRESPONSE[s/"took": 2000/"took": $body.took/]
|
|
|
+// TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
|
|
|
+====
|
|
|
+
|
|
|
+You can use the the returned search ID and the <<get-async-eql-search-api,get
|
|
|
+async EQL search API>> to check the progress of an ongoing async search.
|
|
|
+
|
|
|
+The get async EQL search API also accepts a `wait_for_completion_timeout` query
|
|
|
+parameter. Set the `wait_for_completion_timeout` parameter to a duration you'd
|
|
|
+like to wait for complete search results. If the search does not finish during
|
|
|
+this period, partial search results, if available, are returned.
|
|
|
+
|
|
|
+[%collapsible]
|
|
|
+.*Example*
|
|
|
+====
|
|
|
+The following get async EQL search API request checks the progress of the
|
|
|
+previous async EQL search. The request specifies a `wait_for_completion_timeout`
|
|
|
+query parameter value of `2s` (two seconds).
|
|
|
+
|
|
|
+[source,console]
|
|
|
+----
|
|
|
+GET /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s
|
|
|
+----
|
|
|
+// TEST[skip: no access to search ID]
|
|
|
+
|
|
|
+The request returns the following response. Note the `is_partial` and
|
|
|
+`is_running` properties are `false`, indicating the async EQL search has
|
|
|
+finished and the search results in the `hits` property are complete.
|
|
|
+
|
|
|
+[source,console-result]
|
|
|
+----
|
|
|
+{
|
|
|
+ "id": "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
|
|
|
+ "is_partial": false,
|
|
|
+ "is_running": false,
|
|
|
+ "took": 2000,
|
|
|
+ "timed_out": false,
|
|
|
+ "hits": ...
|
|
|
+}
|
|
|
+----
|
|
|
+// TESTRESPONSE[s/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=/$body.id/]
|
|
|
+// TESTRESPONSE[s/"took": 2000/"took": $body.took/]
|
|
|
// TESTRESPONSE[s/"_index": "frozen_sec_logs"/"_index": "sec_logs"/]
|
|
|
+// TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
|
|
|
====
|
|
|
|
|
|
[discrete]
|
|
@@ -598,10 +592,11 @@ After two seconds, the request returns the following response.
|
|
|
By default, the EQL search API only stores async searches and their results for
|
|
|
five days. After this period, any ongoing searches or saved results are deleted.
|
|
|
|
|
|
-You can use the `keep_alive` parameter to change the duration of this period.
|
|
|
+You can use the EQL search API's `keep_alive` parameter to change the duration
|
|
|
+of this period.
|
|
|
|
|
|
-[%collapsible]
|
|
|
.*Example*
|
|
|
+[%collapsible]
|
|
|
====
|
|
|
In the following EQL search API request, the `keep_alive` parameter is `2d` (two
|
|
|
days). This means that if the search becomes async, its results
|
|
@@ -621,6 +616,24 @@ GET /sec_logs/_eql/search
|
|
|
----
|
|
|
====
|
|
|
|
|
|
+You can use the <<get-async-eql-search-api,get async EQL search API>>'s
|
|
|
+`keep_alive` query parameter to later change the retention period. The new
|
|
|
+retention period starts after the get async EQL search API request executes.
|
|
|
+
|
|
|
+.*Example*
|
|
|
+[%collapsible]
|
|
|
+====
|
|
|
+The following get async EQL search API request sets the `keep_alive` query
|
|
|
+parameter to `5d` (five days). The async search and its results are deleted five
|
|
|
+days after the get async EQL search API request executes.
|
|
|
+
|
|
|
+[source,console]
|
|
|
+----
|
|
|
+GET /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?keep_alive=5d
|
|
|
+----
|
|
|
+// TEST[skip: no access to search ID]
|
|
|
+====
|
|
|
+
|
|
|
[discrete]
|
|
|
[[eql-search-store-sync-eql-search]]
|
|
|
=== Store synchronous EQL searches
|
|
@@ -651,8 +664,35 @@ GET /sec_logs/_eql/search
|
|
|
"""
|
|
|
}
|
|
|
----
|
|
|
-====
|
|
|
|
|
|
+The API returns the following response. Note that a search ID is provided in the
|
|
|
+`id` property. The `is_partial` and `is_running` properties are `false`,
|
|
|
+indicating the EQL search was synchronous and returned complete search results.
|
|
|
+
|
|
|
+[source,console-result]
|
|
|
+----
|
|
|
+{
|
|
|
+ "id": "FjlmbndxNmJjU0RPdExBTGg0elNOOEEaQk9xSjJBQzBRMldZa1VVQ2pPa01YUToxMDY=",
|
|
|
+ "is_partial": false,
|
|
|
+ "is_running": false,
|
|
|
+ "took": 52,
|
|
|
+ "timed_out": false,
|
|
|
+ "hits": ...
|
|
|
+}
|
|
|
+----
|
|
|
+// TESTRESPONSE[s/FjlmbndxNmJjU0RPdExBTGg0elNOOEEaQk9xSjJBQzBRMldZa1VVQ2pPa01YUToxMDY=/$body.id/]
|
|
|
+// TESTRESPONSE[s/"took": 52/"took": $body.took/]
|
|
|
+// TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
|
|
|
+
|
|
|
+You can use the search ID and the <<get-async-eql-search-api,get async EQL
|
|
|
+search API>> to retrieve the same results later.
|
|
|
+
|
|
|
+[source,console]
|
|
|
+----
|
|
|
+GET /_eql/search/FjlmbndxNmJjU0RPdExBTGg0elNOOEEaQk9xSjJBQzBRMldZa1VVQ2pPa01YUToxMDY=
|
|
|
+----
|
|
|
+// TEST[skip: no access to search ID]
|
|
|
+====
|
|
|
|
|
|
[discrete]
|
|
|
[[eql-search-case-sensitive]]
|