The traces/query endpoint has no pagination parameter in the URL. Pagination is handled by the fields of the search itself, in the request body.
Each response returns at most 10,000 records. To page through a larger result, use the search_after field.
IMPORTANTThe OpenSearch scroll and point in time strategies do not work on this endpoint:
- Parameters passed in the URL, such as scroll, are ignored. The request returns 200 OK with a regular result, no scroll cursor, and no error warns you.
- The pit field in the request body returns a 400 error, because the endpoint resolves the index automatically.
For small volumes, use from and size in the request body. Their sum cannot exceed 10,000, which is the record limit per response.
See query best practices to choose the page size.
To page through larger results, use search_after. Instead of jumping to a position, you state where the previous page stopped.
Build the first page with size and sort, as in the First page example below. The sort field is required and must end with a field that is unique per record, to act as a tiebreaker.
In the response, find the last record in hits.hits and copy its sort array exactly as it came. The date appears as a number, and that is how it must be sent back.
First page:
Cursor in the response. The sort array of the last record in hits.hits is what you send back on the next page:
Next page:
IMPORTANTKeep sort and query identical across all pages, and do not use from together with search_after. Differences between one page and the next may duplicate or skip records.
search_after does not freeze the search result. Since new calls keep being indexed while you page through the results, a search with no upper date bound changes content along the way.
To avoid that:
Field | Role in sorting |
|---|---|
sensedia.received_on | Main sort, by date |
sensedia.request_id.keyword | Tiebreaker, unique per record |
sensedia.request_id is the record identifier, which is why it works as a tiebreaker. Being a text field, it can only be sorted in the version with the .keyword suffix. See fields with the .keyword suffix and the field mapping.
The size must fit within the API usage limits: 6 MB of response payload and a 29-second timeout.
_source to return only the fields you need. That reduces the payload and allows larger pages.hits.total stops counting at 10,000 and returns "relation": "gte". Use track_total_hits when you need the exact total.TIPPaginated queries serve specific searches. If your use case is massive and constant data extraction, the recommended path is Data Streaming, which continuously sends the data to the destination you configure.
We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more