saved_searches
Creates, updates, deletes, gets or lists a saved_searches resource.
Overview
| Name | saved_searches |
| Type | Resource |
| Id | clickhouse.clickstack.saved_searches |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Unique saved search ID. Server-generated. (example: 507f1f77bcf86cd799439011) |
name | string | Display name for the saved search. (example: Production Errors) |
source_id | string | ID of the source this saved search queries. (example: 507f1f77bcf86cd799439012) (wire: sourceId) |
team_id | string | ID of the team that owns the saved search. (example: 507f1f77bcf86cd799439013) (wire: teamId) |
created_at | string (date-time) | Creation timestamp. (example: 2025-01-01T00:00:00.000Z) (wire: createdAt) |
filters | array | Structured pinned filters applied to the search. |
order_by | string | ORDER BY expression. Empty uses the source default. (example: Timestamp DESC) (wire: orderBy) |
select | string | Comma-separated list of column expressions to display. Empty uses the source default. (example: Timestamp, ServiceName, Body) |
tags | array | Tags used to organize saved searches. |
updated_at | string (date-time) | Last update timestamp. (example: 2025-06-15T10:30:00.000Z) (wire: updatedAt) |
where | string | Row filter expression. The language is controlled by whereLanguage. (example: SeverityText:ERROR) |
where_language | string | Language used for the where filter. (lucene, sql) (example: lucene) (wire: whereLanguage) |
| Name | Datatype | Description |
|---|---|---|
id | string | Unique saved search ID. Server-generated. (example: 507f1f77bcf86cd799439011) |
name | string | Display name for the saved search. (example: Production Errors) |
source_id | string | ID of the source this saved search queries. (example: 507f1f77bcf86cd799439012) (wire: sourceId) |
team_id | string | ID of the team that owns the saved search. (example: 507f1f77bcf86cd799439013) (wire: teamId) |
created_at | string (date-time) | Creation timestamp. (example: 2025-01-01T00:00:00.000Z) (wire: createdAt) |
filters | array | Structured pinned filters applied to the search. |
order_by | string | ORDER BY expression. Empty uses the source default. (example: Timestamp DESC) (wire: orderBy) |
select | string | Comma-separated list of column expressions to display. Empty uses the source default. (example: Timestamp, ServiceName, Body) |
tags | array | Tags used to organize saved searches. |
updated_at | string (date-time) | Last update timestamp. (example: 2025-06-15T10:30:00.000Z) (wire: updatedAt) |
where | string | Row filter expression. The language is controlled by whereLanguage. (example: SeverityText:ERROR) |
where_language | string | Language used for the where filter. (lucene, sql) (example: lucene) (wire: whereLanguage) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | service_id, click_stack_saved_search_id, organization_id | This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Retrieves a specific saved search by ID. | |
list | select | service_id, organization_id | limit, offset | This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Retrieves saved searches for the authenticated team (paginated). Results are capped at limit (default and maximum 1000). When totalCount exceeds the number of returned items, page with limit/offset to retrieve them all. |
create | insert | service_id, organization_id, name, source_id | This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Creates a new saved search. | |
update | update | service_id, click_stack_saved_search_id, organization_id, name, source_id | This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Updates an existing saved search. This is a full replace: send the full object. Every optional field (select, where, whereLanguage, orderBy, tags, filters) is always written and falls back to its default when omitted, so omitting a field resets it rather than preserving the stored value. | |
delete | delete | service_id, click_stack_saved_search_id, organization_id | This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Deletes a saved search and any alerts attached to it. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
click_stack_saved_search_id | string | Saved search ID (wire: clickStackSavedSearchId) |
organization_id | string | ClickHouse Cloud organization ID. Resolved from the CLICKHOUSE_ORG_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every query as WHERE organization_id = <uuid>. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: CLICKHOUSE_ORG_ID) |
service_id | string (uuid) | ID of the ClickStack service. (wire: serviceId) |
limit | integer | Maximum number of results to return. |
offset | integer | Number of results to skip before returning. |
SELECT examples
- get
- list
This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Retrieves a specific saved search by ID.
SELECT
id,
name,
source_id,
team_id,
created_at,
filters,
order_by,
select,
tags,
updated_at,
where,
where_language
FROM clickhouse.clickstack.saved_searches
WHERE service_id = '{{ service_id }}' -- required
AND click_stack_saved_search_id = '{{ click_stack_saved_search_id }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
;
This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Retrieves saved searches for the authenticated team (paginated). Results are capped at limit (default and maximum 1000). When totalCount exceeds the number of returned items, page with limit/offset to retrieve them all.
SELECT
id,
name,
source_id,
team_id,
created_at,
filters,
order_by,
select,
tags,
updated_at,
where,
where_language
FROM clickhouse.clickstack.saved_searches
WHERE service_id = '{{ service_id }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
AND limit = '{{ limit }}'
AND offset = '{{ offset }}'
;
INSERT examples
- create
- Manifest
This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Creates a new saved search.
INSERT INTO clickhouse.clickstack.saved_searches (
name,
source_id,
select,
where,
where_language,
order_by,
tags,
filters,
service_id,
organization_id
)
SELECT
'{{ name }}' /* required */,
'{{ source_id }}' /* required */,
'{{ select }}',
'{{ where }}',
'{{ where_language }}',
'{{ order_by }}',
'{{ tags }}',
'{{ filters }}',
'{{ service_id }}',
'{{ organization_id }}'
RETURNING
request_id,
result,
status
;
# Description fields are for documentation purposes
- name: saved_searches
props:
- name: service_id
value: "{{ service_id }}"
description: Required parameter for the saved_searches resource.
- name: organization_id
value: "{{ organization_id }}"
description: Required parameter for the saved_searches resource.
- name: name
value: "{{ name }}"
description: |
Display name for the saved search.
- name: source_id
value: "{{ source_id }}"
description: |
ID of the source to query. Must belong to the team.
- name: select
value: "{{ select }}"
description: |
Comma-separated list of column expressions to display. Empty uses the source default.
- name: where
value: "{{ where }}"
description: |
Row filter expression. The language is controlled by whereLanguage.
- name: where_language
value: "{{ where_language }}"
description: |
Language used for the where filter.
valid_values: ['lucene', 'sql']
- name: order_by
value: "{{ order_by }}"
description: |
ORDER BY expression. Empty uses the source default.
- name: tags
value:
- "{{ tags }}"
description: |
Tags used to organize saved searches.
- name: filters
description: |
Structured pinned filters applied to the search.
value:
- type: "{{ type }}"
condition: "{{ condition }}"
UPDATE examples
- update
This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Updates an existing saved search. This is a full replace: send the full object. Every optional field (select, where, whereLanguage, orderBy, tags, filters) is always written and falls back to its default when omitted, so omitting a field resets it rather than preserving the stored value.
UPDATE clickhouse.clickstack.saved_searches
SET
name = '{{ name }}',
source_id = '{{ source_id }}',
select = '{{ select }}',
where = '{{ where }}',
where_language = '{{ where_language }}',
order_by = '{{ order_by }}',
tags = '{{ tags }}',
filters = '{{ filters }}'
WHERE
service_id = '{{ service_id }}' --required
AND click_stack_saved_search_id = '{{ click_stack_saved_search_id }}' --required
AND organization_id = '{{ organization_id }}' --required unless CLICKHOUSE_ORG_ID is set
AND name = '{{ name }}' --required
AND source_id = '{{ source_id }}' --required
RETURNING
request_id,
result,
status;
DELETE examples
- delete
This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Deletes a saved search and any alerts attached to it.
DELETE FROM clickhouse.clickstack.saved_searches
WHERE service_id = '{{ service_id }}' --required
AND click_stack_saved_search_id = '{{ click_stack_saved_search_id }}' --required
AND organization_id = '{{ organization_id }}' --required unless CLICKHOUSE_ORG_ID is set
;