Spaces method and path for this operation:
put /s/{space_id}/api/streams/{name}/queries/{queryId}
Refer to Spaces for more information.
Adds a query to a stream. Noop if the query is already present on the stream.
[Required authorization] Route required privileges: manage_stream.
PUT
/api/streams/{name}/queries/{queryId}
curl \
--request PUT 'https://localhost:5601/api/streams/{name}/queries/{queryId}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--header "kbn-xsrf: true" \
--data '{"description":"Count error-level log events grouped by host name","esql":{"query":"FROM logs* | WHERE log.level == \"error\" | STATS count = COUNT(*) BY host.name"},"title":"Error count by host"}'
Request example
{
"description": "Count error-level log events grouped by host name",
"esql": {
"query": "FROM logs* | WHERE log.level == \"error\" | STATS count = COUNT(*) BY host.name"
},
"title": "Error count by host"
}