Skip to content

Commit 506ea86

Browse files
committed
API Docs: Add docs for new bulk_search_export API
1 parent 7aa85df commit 506ea86

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

docs/api.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,6 +3357,43 @@ In addition to the [Standard Response Format](#standard-response-format), this w
33573357

33583358
### bulk_search_export
33593359

3360+
```
3361+
GET /api/app/bulk_search_export/v1
3362+
```
3363+
3364+
Stream a bulk export of search results for any database index to the client. Requires a valid user session or API Key. Results are scoped by the caller's category and group access in the same way as the search APIs. The response is a streamed file, not JSON.
3365+
3366+
Parameters:
3367+
3368+
| Property Name | Type | Description |
3369+
|---------------|------|-------------|
3370+
| `index` | String | **(Required)** Database index ID to query. Supported indexes are `jobs`, `tickets`, `servers`, `alerts`, `snapshots`, and `activity`. |
3371+
| `query` | String | Optional search query. Defaults to `*`. The query format depends on the selected index. |
3372+
| `columns` | Array(String) or String | **(Required)** Column IDs to include in the export, in the desired order. For HTTP GET query strings, pass a comma-separated list. |
3373+
| `sort_by` | String | Optional. Sorter ID for the index. Defaults to `_id`. |
3374+
| `sort_dir` | Number | Optional. Sort direction: `1` for ascending or `-1` for descending. Defaults to `-1`. |
3375+
| `format` | String | **(Required)** Output format: `csv`, `tsv`, or `ndjson`. |
3376+
| `compress` | Boolean | Optional. If set to any true value, the response is gzip-compressed. For HTTP GET query strings, use `compress=1`. |
3377+
3378+
Query syntax and examples are documented in the search APIs for each index:
3379+
3380+
- [search_jobs](#search_jobs)
3381+
- [search_tickets](#search_tickets)
3382+
- [search_servers](#search_servers)
3383+
- [search_alerts](#search_alerts)
3384+
- [search_snapshots](#search_snapshots)
3385+
- [search_activity](#search_activity)
3386+
3387+
For searchable fields and index definitions, see [Database](db.md).
3388+
3389+
Example request:
3390+
3391+
```
3392+
GET /api/app/bulk_search_export/v1?index=jobs&query=tags:_error&columns=id,event,category,plugin,completed,code&sort_by=completed&sort_dir=-1&format=csv&compress=1
3393+
```
3394+
3395+
Response: `200 OK` with a streamed file. CSV and TSV responses include a header row using the configured column titles. NDJSON responses include one JSON object per line with only the requested columns. A UTF-8 BOM is always prepended for spreadsheet compatibility. If `compress` is enabled, the response is gzip and the filename will end with `.gz`.
3396+
33603397

33613398

33623399
### marketplace

0 commit comments

Comments
 (0)