Update Agentic Search Template API
Introduced 3.10
This is an experimental feature and is not recommended for use in a production environment. For updates on the progress of the feature or if you want to leave feedback, see the associated GitHub issue.
Use this API to update the description or parameter schema of a registered agentic search template. To change the query itself, update the stored script. To change the index that the template searches, delete the template and register it again.
The OpenSearch Agent Server caches each template’s parameter schema for 60 seconds, so an update can take up to 60 seconds to reach the agent server.
Endpoints
PUT /_plugins/_ml/agentic_search_templates/{template_id}
Path parameters
The following table lists the available path parameters.
| Parameter | Data type | Required/Optional | Description |
|---|---|---|---|
template_id | String | Required | The ID of the agentic search template to update. |
Request body fields
The following table lists the available request body fields.
| Field | Data type | Required/Optional | Description |
|---|---|---|---|
description | String | Optional | A description of what the template searches. |
param_schema | Object | Optional | Changes to the parameter schema. For each parameter that you specify, the fields that you provide replace the stored fields, and the other fields are unchanged. You can’t add parameters that aren’t in the stored schema. OpenSearch validates the merged schema against the template before saving it. See The param_schema object. |
Example request
The following request limits the sort_by parameter derived for the product_search template to the price field and leaves the parameter’s other fields unchanged:
PUT /_plugins/_ml/agentic_search_templates/product_search
{
"param_schema": {
"sort_by": {
"enum": ["price"]
}
}
}
Example response
{
"_index": ".plugins-ml-agentic-search-templates",
"_id": "product_search",
"_version": 2,
"result": "updated",
"forced_refresh": true,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"_seq_no": 1,
"_primary_term": 1
}
If the template isn’t registered, the API returns a 404 error. If the merged schema is invalid or the template doesn’t render valid JSON with it, the API returns a 400 error.
Required permissions
If you use the Security plugin, make sure you have the appropriate permissions: cluster:admin/opensearch/ml/agentic_search_templates/update.