---
type: api
title: Bulk update queries
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-streams-name-queries-bulk
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-streams-name-queries-bulk
products:
  - Kibana
---

# Bulk update queries

deprecated

Availability: 9.1+

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/streams/{name}/queries/_bulk`
- `POST` `/s/{space_id}/api/streams/{name}/queries/_bulk`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#basicauth)

#### Path Parameters

- `name` (string · max: 255)
  The name of the stream.

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Bulk update queries of a stream. Can add new queries and delete existing ones.<br/><br/>[Required authorization] Route required privileges: manage_stream.

## Request Body

`application/json`

- `operations` ([] union anyOf) — required
  - **{ index }**
    - `index` (object) — required
      - `description` (string · max: 10000) — optional
      - `esql` (object) — required
        - `query` (string · max: 10000) — required
      - `evidence` ([] string) — optional
      - `expires_at` (string · 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))$) — optional
      - `id` (string · min: 1) — required
        A non-empty string.
      - `severity_score` (number) — optional
      - `title` (string · min: 1) — required
        A non-empty string.
  - **{ delete }**
    - `delete` (object) — required
      - `id` (string · max: 255) — required

## Response

Bulk operation completed successfully.

## Code Examples

#### Console

```console
POST /api/streams/{name}/queries/_bulk
{
  "operations": [
    {
      "index": {
        "description": "Count error-level log events grouped by host name",
        "esql": {
          "query": "FROM logs* | WHERE log.level == \u0022error\u0022 | STATS count = COUNT(*) BY host.name"
        },
        "id": "error-count-by-host",
        "title": "Error count by host"
      }
    },
    {
      "delete": {
        "id": "old-query-id"
      }
    }
  ]
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/streams/{name}/queries/_bulk" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "operations": [
    {
      "index": {
        "description": "Count error-level log events grouped by host name",
        "esql": {
          "query": "FROM logs* | WHERE log.level == \u0022error\u0022 | STATS count = COUNT(*) BY host.name"
        },
        "id": "error-count-by-host",
        "title": "Error count by host"
      }
    },
    {
      "delete": {
        "id": "old-query-id"
      }
    }
  ]
}'
```

