kibana/docs/api/data-views/default-set.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

84 lines
2 KiB
Text

[[data-views-api-default-set]]
=== Set default data view API
++++
<titleabbrev>Set default data view</titleabbrev>
++++
experimental[] Set a default data view ID. Kibana UI will use the default data view unless user picks a different one.
The API doesn't validate if given `index_pattern_id` is a valid id.
[[data-views-api-default-set-request]]
==== Request
`POST <kibana host>:<port>/api/index_patterns/default`
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/default`
[[data-views-api-default-set-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.
[[data-views-api-default-set-body]]
==== Request body
`index_pattern_id`:: (Required, `string` or `null`) Sets a default data view id. Use `null` to unset a default data view.
`force`:: (Optional, boolean) Updates existing default data view id. The default is `false`.
[[data-views-api-default-set-codes]]
==== Response code
`200`::
Indicates a successful call.
[[data-views-api-default-set-example]]
==== Example
Set the default data view id if none is set:
[source,sh]
--------------------------------------------------
$ curl -X POST api/index_patterns/default
{
"index_pattern_id": "..."
}
--------------------------------------------------
// KIBANA
Upsert the default data view:
[source,sh]
--------------------------------------------------
$ curl -X POST api/index_patterns/default
{
"index_pattern_id": "...",
"force": true
}
--------------------------------------------------
// KIBANA
Unset the default data view:
[source,sh]
--------------------------------------------------
$ curl -X POST api/index_patterns/default
{
"index_pattern_id": null,
"force": true
}
--------------------------------------------------
// KIBANA
The API returns:
[source,sh]
--------------------------------------------------
{
"acknowledged": true
}
--------------------------------------------------