---
type: api
title: "Get an ES|QL view"
description: "Returns a stored ES|QL view."
url: https://www.elastic.co/elastic/docs-builder/docs/5111/api/elasticsearch/operation/operation-esql-get-view
resource: https://www.elastic.co/elastic/docs-builder/docs/5111/api/elasticsearch/operation/operation-esql-get-view
products:
  - Elasticsearch
---

# Get an ES|QL view

Authentication: required

Availability: Experimental since 9.4

## Paths

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

#### Path parameters

- `name` (union string | string[]) — optional, leave it out to use `/_query/view`
  The comma-separated view names to retrieve.

## Description

Returns a stored ES|QL view.

## Required privileges

- Index privileges: `read_view_metadata`

## Responses

`application/json`

- `views` (object[])
  - `name` (string)
    The name of the ES|QL view
  - `query` (string)
    The ES|QL query
## Code examples

#### Console

```console
GET /_query/view/NAME
```

#### curl

```curl
curl -X GET "${ELASTICSEARCH_URL}/_query/view/${NAME}" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## 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
{
  "views": [
    {
      "name": "string",
      "query": "string"
    }
  ]
}
```

