kibana/docs/api/data-views/update.asciidoc
Nick Peihl 95d4820592
[Docs] Fix curl examples in update data view api docs (#153292)
## Summary

Fixes typos in the curl examples in the Update data views API docs.

[Reported by a community
user](https://discuss.elastic.co/t/kibana-data-view-update-api-request-doesnt-work/327435/5).
2023-04-03 16:02:26 -04:00

120 lines
2.4 KiB
Text

[[data-views-api-update]]
=== Update data view API
++++
<titleabbrev>Update data view</titleabbrev>
++++
experimental[] Update part of an data view. Only the specified fields are updated in the
data view. Unspecified fields stay as they are persisted.
[[data-views-api-update-request]]
==== Request
`POST <kibana host>:<port>/api/data_views/data_view/<id>`
`POST <kibana host>:<port>/s/<space_id>/api/data_views/data_view/<id>`
[[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 `<my-view>` 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": {
}
}
--------------------------------------------------