---
type: api
title: Update a data view
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-updatedataviewdefault
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-updatedataviewdefault
products:
  - Kibana
---

# Update a data view

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

## Paths

- `POST` `/api/data_views/data_view/{viewId}`
- `POST` `/s/{space_id}/api/data_views/data_view/{viewId}`

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

#### Path Parameters

- `viewId` (string)
  An identifier for the data view.

## Description

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

## Request Body

`application/json`

- `data_view` (object) — required
  The data view properties you want to update. Only the specified properties are updated in the data view. Unspecified fields stay as they are persisted.
  - `allowNoIndex` (boolean) — optional
    Allows the data view saved object to exist before the data is available.
  - `fieldFormats` (object) — optional
    A map of field formats by field name.
  - `fields` (object) — optional
  - `name` (string) — optional
  - `runtimeFieldMap` (map string to object) — optional
    Map values ({})
    - `script` (object) — required
      - `source` (string) — optional
        Script for the runtime field.
    - `type` (string) — required
      Mapping type of the runtime field.
  - `sourceFilters` ([] object) — optional
    The array of field names you want to filter out in Discover.
    - `value` (string) — required
  - `timeFieldName` (string) — optional
    The timestamp field name, which you use for time-based data views.
  - `title` (string) — optional
    Comma-separated list of data streams, indices, and aliases that you want to search. Supports wildcards (`*`).
  - `type` (string) — optional
    When set to `rollup`, identifies the rollup data views.
  - `typeMeta` ({}) — optional
    When you use rollup indices, contains the field list for the rollup data view API endpoints.
    - `aggs` (object) — required
      A map of rollup restrictions by aggregation type and field name.
    - `params` (object) — required
      Properties for retrieving rollup fields.
- `refresh_fields` (boolean · default: false) — optional
  Reloads the data view fields after the data view is updated.

## Responses

#### `200`

Indicates a successful call.

`application/json`

- `data_view` (object)
  - `allowNoIndex` (boolean)
    Allows the data view saved object to exist before the data is available.
  - `fieldAttrs` (map string to object)
    Map values ({})
    - `count` (integer)
      Popularity count for the field.
    - `customDescription` (string · max: 300)
      Custom description for the field.
    - `customLabel` (string)
      Custom label for the field.
  - `fieldFormats` (object)
    A map of field formats by field name.
  - `fields` (object)
  - `id` (string)
  - `name` (string)
    The data view name.
  - `namespaces` ([] object)
    An array of space identifiers for sharing the data view between multiple spaces.
  - `runtimeFieldMap` (map string to object)
    Map values ({})
    - `script` (object)
      - `source` (string)
        Script for the runtime field.
    - `type` (string)
      Mapping type of the runtime field.
  - `sourceFilters` ([] object)
    The array of field names you want to filter out in Discover.
    - `value` (string)
  - `timeFieldName` (string)
    The timestamp field name, which you use for time-based data views.
  - `title` (string)
    Comma-separated list of data streams, indices, and aliases that you want to search. Supports wildcards (`*`).
  - `typeMeta` ({}) — nullable
    When you use rollup indices, contains the field list for the rollup data view API endpoints.
    - `aggs` (object)
      A map of rollup restrictions by aggregation type and field name.
    - `params` (object)
      Properties for retrieving rollup fields.
  - `version` (string)
#### `400`

Bad request

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (number)
## Code Examples

#### Console

```console
POST /api/data_views/data_view/{viewId}
{
  "data_view": {
    "allowNoIndex": false,
    "name": "Kibana Sample Data eCommerce",
    "timeFieldName": "order_date",
    "title": "kibana_sample_data_ecommerce"
  },
  "refresh_fields": true
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/data_views/data_view/{viewId}" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "data_view": {
    "allowNoIndex": false,
    "name": "Kibana Sample Data eCommerce",
    "timeFieldName": "order_date",
    "title": "kibana_sample_data_ecommerce"
  },
  "refresh_fields": true
}'
```

