Bulk update queries Technical Preview; added in 9.1.0

POST /api/streams/{name}/queries/_bulk

Spaces method and path for this operation:

post /s/{space_id}/api/streams/{name}/queries/_bulk

Refer to Spaces for more information.

Bulk update queries of a stream. Can add new queries and delete existing ones.

[Required authorization] Route required privileges: manage_stream.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

Path parameters

  • name string Required

    The name of the stream.

application/json

Body

  • operations array[object] Required
    Any of:

Responses

  • 200

    Bulk operation completed successfully.

POST /api/streams/{name}/queries/_bulk
curl \
 --request POST 'https://localhost:5601/api/streams/{name}/queries/_bulk' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --header "kbn-xsrf: true" \
 --data '{"operations":[{"index":{"description":"Count error-level log events grouped by host name","esql":{"query":"FROM logs* | WHERE log.level == \"error\" | STATS count = COUNT(*) BY host.name"},"id":"error-count-by-host","title":"Error count by host"}},{"delete":{"id":"old-query-id"}}]}'
Request example
{
  "operations": [
    {
      "index": {
        "description": "Count error-level log events grouped by host name",
        "esql": {
          "query": "FROM logs* | WHERE log.level == \"error\" | STATS count = COUNT(*) BY host.name"
        },
        "id": "error-count-by-host",
        "title": "Error count by host"
      }
    },
    {
      "delete": {
        "id": "old-query-id"
      }
    }
  ]
}