We are paginating through all endpoints using the Kibana api/endpoint/metadata API. The API does not support PIT or search_after, so we are using cursor-based pagination with
sortField=last_checkin, sortDirection=asc, and advancing via a kuery filter:
kuery: last_checkin >= ""
We always keep page=0 and advance the cursor to the last_checkin of the last endpoint in each batch, staying within Elasticsearch's 10,000-result window.
The Problem:
When more than pageSize (100) endpoints share the exact same last_checkin timestamp, the cursor never advances. Every subsequent request returns the same batch of 100 endpoints
with the same timestamp, causing the pagination loop to run indefinitely without making progress.
Example scenario:
- Page 1 returns 100 endpoints, all with last_checkin = "2024-01-15T10:00:00Z"
- Cursor is set to "2024-01-15T10:00:00Z" and next request uses kuery: last_checkin >= "2024-01-15T10:00:00Z"
- Page 2 returns the same 100 endpoints again — loop is stuck
What we've tried:
- Tracking seen agent IDs at the current cursor timestamp to skip duplicates across page boundaries — this works for overlap between two consecutive timestamps, but breaks down
when an entire batch (or more) shares one timestamp. - Using > instead of >= in the kuery — this causes us to skip all endpoints at the current timestamp entirely and miss data.
Questions:
-
Is there a way to use page + pageSize with sortField=last_checkin to paginate through a group of endpoints that all share the same timestamp (i.e., is there a stable secondary
sort key available in this API)? -
Does the
api/endpoint/metadataAPI support any tiebreaker sort field (e.g., agent.id) that could be combined with last_checkin to make each page's cursor unique? -
Is there a recommended approach for paginating after 10,000 endpoints using the Kibana API? We are aware of PIT + search_after on the underlying metrics-endpoint.metadata_united_default index but wanted to confirm if there's a supported API-level solution first.
-
Is there any other API endpoint that we can use to fetch the same information?