Bulk update queries Deprecated Experimental; 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.

    Maximum length is 255.

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 '"{\n  \"operations\": [\n    {\n      \"index\": {\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        \"id\": \"error-count-by-host\",\n        \"title\": \"Error count by host\"\n      }\n    },\n    {\n      \"delete\": {\n        \"id\": \"old-query-id\"\n      }\n    }\n  ]\n}"'
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"
      }
    }
  ]
}