ALTER CORTEX SEARCH SERVICE¶
Modifies the properties of an existing Cortex Search service.
Syntax¶
ALTER CORTEX SEARCH SERVICE [ IF EXISTS ] <name>
{ SUSPEND | RESUME } [ { INDEXING | SERVING } ]
ALTER CORTEX SEARCH SERVICE [ IF EXISTS ] <name> SET
[ TARGET_LAG = { '<num> { seconds | minutes | hours | days }' } ]
[ WAREHOUSE = <warehouse_name> ]
[ COMMENT = '<string_literal>' ];
Parameters¶
name
Specifies the identifier for the Cortex Search service to alter.
If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
For more information, see Identifier requirements.
{ SUSPEND | RESUME } ...
Suspends or resumes the indexing, serving or both for a Cortex Search service. You can specify one of the following keywords to indicate which layer to suspend or resume:
INDEXING
The target that indicates the indexing layer of the Cortex Search Service. For more details, see Usage Notes.
SERVING
The target that indicates the serving layer of the Cortex Search Service. For more details, see Usage Notes.
If you do not specify either keyword, both the indexing and serving layers are suspended or resumed.
SET ...
Sets one or more specified properties or parameters to set for the Cortex Search service:
TARGET_LAG = 'num { seconds | minutes | hours | days }'
Specifies the maximum amount of time that the Cortex Search service content should lag behind updates to the base tables specified in the source query.
WAREHOUSE = warehouse_name
Specifies the warehouse to use for running the source query, building the search index, and keeping it refreshed per the TARGET_LAG target.
COMMENT = 'string_literal'
Adds a comment or overwrites an existing comment for the search service.
Access Control Requirements¶
Privilege |
Object |
---|---|
OWNERSHIP |
Cortex Search service you want to modify properties on. |
The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage Notes¶
Attention
Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.
INDEXING and SERVING states¶
INDEXING is the target that indicates the indexing layer of the Cortex Search Service. When in the RUNNING state, changes in base tables referenced by the service’s source query will prompt refreshes of the materialized data stored as part of the search index. These refreshes incur cost in the form of warehouse compute and vector embeddings. When in the SUSPENDED state, changes in base tables will not trigger refreshes, nor will they be reflected in the queryable data of the Cortex Search Service.
SERVING is the target that indicates the serving layer of the Cortex Search Service. This target must be in the RUNNING state for the service to be queryable. When in the suspended state, the Cortex Search Service will not incur billing in the form of Cortex Search’s serving costs.
For detailed cost considerations, see Cost considerations.
The INDEXING and SERVING layers of the Cortex Search Service can be managed independently. For instance, if SERVING is in the running state while INDEXING is suspended, you can still query the service. However, the service will not reflect any changes in the base data regardless of the TARGET_LAG until INDEXING is resumed and a refresh is completed successfully.
Conversely, if INDEXING is running while SERVING is suspended, the index will continue to refresh. When SERVING is resumed, the loaded index that becomes queryable will reflect the most up-to-date source data.
When neither the SERVING nor INDEXING keywords are specified, both targets will be impacted by the specified action.
Examples¶
The following example changes warehouse used by the Cortex Search service named mysvc
to my_new_wh
:
ALTER CORTEX SEARCH SERVICE mysvc SET WAREHOUSE = my_new_wh;
The following example sets the comment field of the Cortex Search service named mysvc
to new_comment
:
ALTER CORTEX SEARCH SERVICE mysvc SET COMMENT = 'new_comment';
The following example changes the target refresh lag of the Cortex Search service named mysvc
to 1 hour
:
ALTER CORTEX SEARCH SERVICE mysvc SET TARGET_LAG = '1 hour';
The following example suspends serving for a Cortex Search service named mysvc
;
ALTER CORTEX SEARCH SERVICE mysvc SUSPEND SERVING;