---
title: "Update a data view"
method: POST
path: "/api/data_views/data_view/{viewId}"
tags: ["data views"]
---

# Update a data view

`POST /api/data_views/data_view/{viewId}`

**Spaces method and path for this operation:**

<div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/data_views/data_view/{viewId}</span></div>

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

Update an existing data view. Only the fields provided in the request body are updated.

## Path parameters

- `viewId` string, required

## Headers

- `kbn-xsrf` string, required

## Request body

- DataViewsUpdateDataViewRequestObject
  - `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 — Allows the data view saved object to exist before the data is available. Defaults to `false`.
    - `fieldFormats` DataViewsFieldformats — A map of field formats by field name.
    - `fields` object
    - `name` string
    - `runtimeFieldMap` object
    - `sourceFilters` object[] — The array of field names you want to filter out in Discover.
      - `value` string, required
    - `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 (`*`).
    - `type` string — When set to `rollup`, identifies the rollup data views.
    - `typeMeta` DataViewsTypemeta — 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 — Reloads the data view fields after the data view is updated.

## Response `200`

Indicates a successful call.

- DataViewsDataViewResponseObject
  - `data_view` object
    - `allowNoIndex` boolean — Allows the data view saved object to exist before the data is available. Defaults to `false`.
    - `fieldAttrs` object
    - `fieldFormats` DataViewsFieldformats — A map of field formats by field name.
    - `fields` object
    - `id` string
    - `name` string — The data view name.
    - `namespaces` string[] — An array of space identifiers for sharing the data view between multiple spaces.
    - `runtimeFieldMap` object
    - `sourceFilters` object[] — The array of field names you want to filter out in Discover.
      - `value` string, required
    - `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` DataViewsTypemetaResponse, 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

## Other responses

- `400` — Bad request

---

[API](https://skmtc.net/elastic/apis/kibana-apis.md) · [All operations](https://skmtc.net/elastic/apis/kibana-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/kibana-apis/versions/531c9e2a7d23/schema)
