kibana/docs/api/data-views/update.asciidoc
Matthew Kime eb2ddcd7c6
[data views] data view api docs - index patterns => data views (#119415)
* initial pass at changing urls and anchors

* update api.asciidoc

* upate a few more anchor tags

* upate a few more anchor tags

* update data view api docs

* Update delete.asciidoc

* Update default-get.asciidoc

* add redirects

* fix redirects

* remove duplicate redirect

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-01 07:32:05 -06:00

112 lines
2.5 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/index_patterns/index_pattern/<id>`
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<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`.
`index_pattern`::
(Required, object) The data view fields you want to update.
+
You can partially update the following fields:
* `title`
* `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-pattern>` data view:
[source,sh]
--------------------------------------------------
$ curl -X POST api/saved_objects/index-pattern/my-pattern
{
"index_pattern": {
"title": "some-other-pattern-*"
}
}
--------------------------------------------------
// KIBANA
Customize the update behavior:
[source,sh]
--------------------------------------------------
$ curl -X POST api/saved_objects/index-pattern/my-pattern
{
"refresh_fields": true,
"index_pattern": {
"fields": {}
}
}
--------------------------------------------------
// KIBANA
All update fields are optional, but you can specify the following fields:
[source,sh]
--------------------------------------------------
$ curl -X POST api/saved_objects/index-pattern/my-pattern
{
"index_pattern": {
"title": "...",
"timeFieldName": "...",
"sourceFilters": [],
"fieldFormats": {},
"type": "...",
"typeMeta": {},
"fields": {},
"runtimeFieldMap": {}
}
}
--------------------------------------------------
// KIBANA
The API returns the updated data view object:
[source,sh]
--------------------------------------------------
{
"index_pattern": {
}
}
--------------------------------------------------