---
type: api
title: "Create or update an ES|QL view"
description: "Required authorization"
url: https://www.elastic.co/elastic/docs-builder/docs/5106/api/elasticsearch/operation/operation-esql-put-view
resource: https://www.elastic.co/elastic/docs-builder/docs/5106/api/elasticsearch/operation/operation-esql-put-view
products:
  - Elasticsearch
---

# Create or update an ES|QL view

Authentication: required

Availability: Experimental since 9.4

## Paths

- `PUT` `/_query/view/{name}`

#### Path parameters

- `name` (string) — required
  The view name to create or update.

## Required privileges

- Index privileges: `create_view`

## Request body

`application/json`

- `query` (string) — required
  The ES|QL query string from which to create a view.

## Responses

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code examples

#### Console

```console
PUT /_query/view/NAME
{
  "query": "string"
}
```

#### curl

```curl
curl -X PUT "${ELASTICSEARCH_URL}/_query/view/${NAME}" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "string"
  }'
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "acknowledged": false
}
```

