Skip to main content

saved_searches

Creates, updates, deletes, gets or lists a saved_searches resource.

Overview

Namesaved_searches
TypeResource
Idclickhouse.clickstack.saved_searches

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringUnique saved search ID. Server-generated. (example: 507f1f77bcf86cd799439011)
namestringDisplay name for the saved search. (example: Production Errors)
source_idstringID of the source this saved search queries. (example: 507f1f77bcf86cd799439012) (wire: sourceId)
team_idstringID of the team that owns the saved search. (example: 507f1f77bcf86cd799439013) (wire: teamId)
created_atstring (date-time)Creation timestamp. (example: 2025-01-01T00:00:00.000Z) (wire: createdAt)
filtersarrayStructured pinned filters applied to the search.
order_bystringORDER BY expression. Empty uses the source default. (example: Timestamp DESC) (wire: orderBy)
selectstringComma-separated list of column expressions to display. Empty uses the source default. (example: Timestamp, ServiceName, Body)
tagsarrayTags used to organize saved searches.
updated_atstring (date-time)Last update timestamp. (example: 2025-06-15T10:30:00.000Z) (wire: updatedAt)
wherestringRow filter expression. The language is controlled by whereLanguage. (example: SeverityText:ERROR)
where_languagestringLanguage used for the where filter. (lucene, sql) (example: lucene) (wire: whereLanguage)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_id, click_stack_saved_search_id, organization_idThis 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.
listselectservice_id, organization_idlimit, offsetThis 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.
createinsertservice_id, organization_id, name, source_idThis 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.
updateupdateservice_id, click_stack_saved_search_id, organization_id, name, source_idThis 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.
deletedeleteservice_id, click_stack_saved_search_id, organization_idThis 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.

NameDatatypeDescription
click_stack_saved_search_idstringSaved search ID (wire: clickStackSavedSearchId)
organization_idstringClickHouse 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_idstring (uuid)ID of the ClickStack service. (wire: serviceId)
limitintegerMaximum number of results to return.
offsetintegerNumber of results to skip before returning.

SELECT examples

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
;

INSERT examples

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
;

UPDATE examples

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

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
;