Skip to content

Commit c3b5cfe

Browse files
authored
[Fleet] Add examples for 10k+ agents API fetch (#1193)
Updates our API examples with recipes for fetching more than 10k agents with `/api/fleet/agents`. Docs preview: [List all Elastic Agents](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/1193/reference/fleet/fleet-api-docs#list-agents-api) section Closes: elastic/ingest-docs#1726 @jen-huang Sorry this one took me ages to get to. Please let me know whatever I may have missed. By the way, I left the examples as curl since the others on that page are in the same format.
1 parent 04fac76 commit c3b5cfe

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

reference/fleet/fleet-api-docs.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,3 +405,51 @@ Example response (formatted for readability):
405405
"total" : 4
406406
}
407407
```
408+
409+
## List all {{agents}} [list-agents-api]
410+
411+
Use the [Get agents API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-get-fleet-agents) to retrieve a list of currently enrolled {{agents}}:
412+
413+
```shell
414+
curl -X GET 'http://<user>:<pass>@<kibana url>/api/fleet/agents
415+
```
416+
417+
By default, a maximum of 10,000 agents are returned, with 20 agents listed per page.
418+
419+
### List all {{agents}} with `perPage` setting [list-agents-api-perpage]
420+
421+
The following query returns the same list, showing 10,000 {{agents}} per page:
422+
423+
```shell
424+
curl -X GET 'http://<user>:<pass>@<kibana url>/api/fleet/agents?perPage=10000'
425+
```
426+
427+
### List the next set of 10,000 {{agents}} [list-agents-api-next-set]
428+
```{applies_to}
429+
stack: ga 9.1
430+
```
431+
432+
Beginning with {{stack}} version 9.1, the previous query response includes a `nextSearchAfter` parameter that you can pass in a subsequent call, to retrieve the next page of 10,000 enrolled agents:
433+
434+
```shell
435+
curl -X GET 'http://<user>:<pass>@<kibana url>/api/fleet/agents?perPage=10000&searchAfter=<nextSearchAfter>'
436+
```
437+
438+
### List all {{agents}} for a point in time [list-agents-api-point-in-time]
439+
```{applies_to}
440+
stack: ga 9.1
441+
```
442+
443+
Beginning with {{stack}} version 9.1, you can also capture a point-in-time ID (`pitId`) parameter from the `Get agents API` response, and use that together with the `nextSearchAfter` parameter to capture the next page of 10,000 enrolled agents for a specific point in time.
444+
445+
Include the `openPit` and `pitKeepAlive` parameters in your initial request:
446+
447+
```shell
448+
curl -X GET 'http://<user>:<pass>@<kibana url>/api/fleet/agents?perPage=10000&openPit=true&pitKeepAlive=5m'
449+
```
450+
451+
You can then use the returned values in a new request to retrieve the next set of 10,000 agents:
452+
453+
```shell
454+
curl -X GET 'http://<user>:<pass>@<kibana url>/api/fleet/agents?perPage=10000&searchAfter=<nextSearchAfter>&pitId=<pit id>&pitKeepAlive=5m'
455+
```

0 commit comments

Comments
 (0)