Spaces method and path for this operation:
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.
Path parameters
-
The name of the stream.
Maximum length is
255. -
The identifier of the query.
Maximum length is
255.
Body
-
Maximum length is
10000. Default value is empty. -
Additional properties are NOT allowed.
-
Maximum length of each is
10000. -
Format should match the following pattern:
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$. -
A non-empty string.
Minimum length is
1.
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 '"{\n \"description\": \"Count error-level log events grouped by host name\",\n \"esql\": {\n \"query\": \"FROM logs* | WHERE log.level == \\\"error\\\" | STATS count = COUNT(*) BY host.name\"\n },\n \"title\": \"Error count by host\"\n}"'
{
"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"
}