mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -04:00
86 lines
2.1 KiB
Text
86 lines
2.1 KiB
Text
[[index-patterns-api-default-set]]
|
|
=== Set default index pattern API
|
|
++++
|
|
<titleabbrev>Set default index pattern</titleabbrev>
|
|
++++
|
|
|
|
deprecated::[8.0.0,Use the {api-kibana}/group/endpoint-data-views[data views API] instead.]
|
|
|
|
experimental[] Set a default index pattern ID. Kibana UI will use default index pattern unless user picks a different one.
|
|
The API doesn't validate if given `index_pattern_id` is a valid id.
|
|
|
|
[[index-patterns-api-default-set-request]]
|
|
==== Request
|
|
|
|
`POST <kibana host>:<port>/api/index_patterns/default`
|
|
|
|
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/default`
|
|
|
|
[[index-patterns-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.
|
|
|
|
[[index-patterns-api-default-set-body]]
|
|
==== Request body
|
|
|
|
`index_pattern_id`:: (Required, `string` or `null`) Sets a default index pattern id. Use `null` to unset a default index pattern.
|
|
|
|
`force`:: (Optional, boolean) Updates existing default index pattern id. The default is `false`.
|
|
|
|
|
|
[[index-patterns-api-default-set-codes]]
|
|
==== Response code
|
|
|
|
`200`::
|
|
Indicates a successful call.
|
|
|
|
[[index-patterns-api-default-set-example]]
|
|
==== Example
|
|
|
|
Set the default index pattern id if none is set:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
$ curl -X POST api/index_patterns/default
|
|
{
|
|
"index_pattern_id": "..."
|
|
}
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
|
|
Upsert the default index pattern:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
$ curl -X POST api/index_patterns/default
|
|
{
|
|
"index_pattern_id": "...",
|
|
"force": true
|
|
}
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
Unset the default index pattern:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
$ curl -X POST api/index_patterns/default
|
|
{
|
|
"index_pattern_id": null,
|
|
"force": true
|
|
}
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
The API returns:
|
|
|
|
[source,sh]
|
|
--------------------------------------------------
|
|
{
|
|
"acknowledged": true
|
|
}
|
|
--------------------------------------------------
|
|
|