[[data-views-api-update]]
=== Update data view API
++++
Update data view
++++
experimental[] Update part of an data view. Only the specified fields are updated in the
data view. Unspecified fields stay as they are persisted.
[NOTE]
====
For the most up-to-date API details, refer to the
{kib-repo}/tree/{branch}/src/plugins/data_views/docs/openapi[open API specification].
====
[[data-views-api-update-request]]
==== Request
`POST :/api/data_views/data_view/`
`POST :/s//api/data_views/data_view/`
[[data-views-api-update-path-params]]
==== Path parameters
`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
`id`::
(Required, string) The ID of the data view you want to update.
[[data-views-api-update-request-body]]
==== Request body
`refresh_fields`:: (Optional, boolean) Reloads the data view fields after
the data view is updated. The default is `false`.
`data_view`::
(Required, object) The data view fields you want to update.
+
You can partially update the following fields:
* `title`
* `name`
* `timeFieldName`
* `fields`
* `sourceFilters`
* `fieldFormatMap`
* `type`
* `typeMeta`
[[data-views-api-update-errors-codes]]
==== Response code
`200`::
Indicates a successful call.
[[data-views-api-update-example]]
==== Examples
Update a title of the `` data view:
[source,sh]
--------------------------------------------------
$ curl -X POST api/data_views/data_view/my-view
{
"data_view": {
"title": "some-other-view-*"
}
}
--------------------------------------------------
// KIBANA
Customize the update behavior:
[source,sh]
--------------------------------------------------
$ curl -X POST api/data_views/data_view/my-view
{
"refresh_fields": true,
"data_view": {
"fields": {}
}
}
--------------------------------------------------
// KIBANA
All update fields are optional, but you can specify the following fields:
[source,sh]
--------------------------------------------------
$ curl -X POST api/data_views/data_view/my-view
{
"data_view": {
"title": "...",
"name": "...",
"timeFieldName": "...",
"sourceFilters": [],
"fieldFormats": {},
"type": "...",
"typeMeta": {},
"fields": {},
"runtimeFieldMap": {}
}
}
--------------------------------------------------
// KIBANA
The API returns the updated data view object:
[source,sh]
--------------------------------------------------
{
"data_view": {
}
}
--------------------------------------------------