2018-05-30 18:27:48 +02:00
[[saved-objects-api-bulk-get]]
2019-09-06 18:09:57 +02:00
=== Bulk get objects API
++++
<titleabbrev>Bulk get objects</titleabbrev>
++++
2018-05-30 18:27:48 +02:00
2019-10-16 22:10:40 +02:00
experimental[] Retrieve multiple {kib} saved objects by ID.
2018-12-05 22:20:58 +01:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-bulk-get-request]]
2018-05-30 18:27:48 +02:00
==== Request
2020-03-20 22:33:20 +01:00
`POST <kibana host>:<port>/api/saved_objects/_bulk_get`
2018-05-30 18:27:48 +02:00
2020-03-20 22:33:20 +01:00
`POST <kibana host>:<port>/s/<space_id>/api/saved_objects/_bulk_get`
2019-10-18 19:17:54 +02:00
[[saved-objects-api-bulk-get-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.
2019-09-06 18:09:57 +02:00
[[saved-objects-api-bulk-get-request-body]]
2018-05-30 18:27:48 +02:00
==== Request Body
2019-09-06 18:09:57 +02:00
`type`::
(Required, string) Valid options include `visualization`, `dashboard`, `search`, `index-pattern`, `config`, and `timelion-sheet`.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
`id`::
2019-10-18 19:17:54 +02:00
(Required, string) ID of the retrieved object. The ID includes the {kib} unique identifier or a custom identifier.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
`fields`::
2020-07-14 20:43:08 +02:00
(Optional, array) The fields to return in the `attributes` key of the object response.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-bulk-get-response-body]]
==== Response body
2018-05-30 18:27:48 +02:00
2019-10-18 19:17:54 +02:00
`saved_objects`::
2020-05-27 21:44:41 +02:00
(array) Top-level property containing objects that represent the response for each of the requested objects. The order of the objects in the response is identical to the order of the objects in the request.
2019-03-15 00:22:30 +01:00
2019-09-06 18:09:57 +02:00
Saved objects that are unable to persist are replaced with an error object.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-bulk-get-body-codes]]
==== Response code
2018-05-30 18:27:48 +02:00
2019-10-18 19:17:54 +02:00
`200`::
Indicates a successful call.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-bulk-get-body-example]]
==== Example
2018-05-30 18:27:48 +02:00
2019-10-18 19:17:54 +02:00
Retrieve an index pattern with the `my-pattern` ID, and a dashboard with the `my-dashboard` ID:
2018-05-30 18:27:48 +02:00
2020-03-20 22:33:20 +01:00
[source,sh]
2018-05-30 18:27:48 +02:00
--------------------------------------------------
2020-07-14 21:59:21 +02:00
$ curl -X POST api/saved_objects/_bulk_get
2018-05-30 18:27:48 +02:00
[
{
"type": "index-pattern",
"id": "my-pattern"
},
{
"type": "dashboard",
2019-10-18 19:17:54 +02:00
"id": "be3733a0-9efe-11e7-acb3-3dab96693fab"
2018-05-30 18:27:48 +02:00
}
]
--------------------------------------------------
// KIBANA
2019-09-06 18:09:57 +02:00
The API returns the following:
2018-05-30 18:27:48 +02:00
2020-03-20 22:33:20 +01:00
[source,sh]
2018-05-30 18:27:48 +02:00
--------------------------------------------------
{
"saved_objects": [
{
"id": "my-pattern",
"type": "index-pattern",
"version": 1,
"attributes": {
"title": "my-pattern-*"
}
},
{
"id": "my-dashboard",
"type": "dashboard",
"error": {
"statusCode": 404,
"message": "Not found"
}
}
]
}
--------------------------------------------------
2019-09-06 18:09:57 +02:00
Only the index pattern exists.