kibana/docs/api/data-views/update-fields.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

100 lines
2.3 KiB
Text

[[data-views-fields-api-update]]
=== Update data view fields API
++++
<titleabbrev>Update data view fields metadata</titleabbrev>
++++
experimental[] Update fields presentation metadata, such as `count`,
`customLabel`, and `format`. You can update multiple fields in one request. Updates
are merged with persisted metadata. To remove existing metadata, specify `null` as the value.
[[data-views-fields-api-update-request]]
==== Request
`POST <kibana host>:<port>/api/index_patterns/index_pattern/<id>/fields`
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<id>/fields`
[[data-views-fields-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 fields you want to update.
[[data-views-fields-api-update-request-body]]
==== Request body
`fields`::
(Required, object) the field object
[[data-views-fields-api-update-errors-codes]]
==== Response code
`200`::
Indicates a successful call.
[[data-views-fields-api-update-example]]
==== Examples
Set popularity `count` for field `foo`:
[source,sh]
--------------------------------------------------
$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields
{
"fields": {
"foo": {
"count": 123
}
}
}
--------------------------------------------------
// KIBANA
Update multiple metadata fields in one request:
[source,sh]
--------------------------------------------------
$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields
{
"fields": {
"foo": {
"count": 123,
"customLabel": "Foo"
},
"bar": {
"customLabel": "Bar"
}
}
}
--------------------------------------------------
// KIBANA
Use `null` value to delete metadata:
[source,sh]
--------------------------------------------------
$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields
{
"fields": {
"foo": {
"customLabel": null
}
}
}
--------------------------------------------------
// KIBANA
The endpoint returns the updated data view object:
[source,sh]
--------------------------------------------------
{
"index_pattern": {
}
}
--------------------------------------------------