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-09-18 17:54:28 +02:00
experimental[] Retrieves 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
`POST /api/saved_objects/_bulk_get`
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`::
(Required, string) ID of the retrieved object.
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
`fields`::
(Optional, array) The fields returned in the object response.
[[saved-objects-api-bulk-get-response-body]]
==== Response body
2018-05-30 18:27:48 +02:00
2019-09-06 18:09:57 +02:00
`saved_objects`::
(array) Top-level property the contains 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-09-06 18:09:57 +02:00
`200`::
Indicates a successfully 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-09-06 18:09:57 +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
[source,js]
--------------------------------------------------
POST api/saved_objects/_bulk_get
[
{
"type": "index-pattern",
"id": "my-pattern"
},
{
"type": "dashboard",
"id": "my-dashboard"
}
]
--------------------------------------------------
// KIBANA
2019-09-06 18:09:57 +02:00
The API returns the following:
2018-05-30 18:27:48 +02:00
[source,js]
--------------------------------------------------
{
"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.