* Add new references attribute to saved objects * Add dual support for dashboard export API * Use new relationships API supporting legacy relationships extraction * Code cleanup * Fix style and CI error * Add missing spaces test for findRelationships * Convert collect_references_deep to typescript * Add missing trailing commas * Fix broken test by making saved object API consistently return references * Fix broken api integration tests * Add comment about the two TS types for saved object * Only return title from the attributes returned in findRelationships * Fix broken test * Add missing security tests * Drop filterTypes support * Implement references to search, dashboard, visualization, graph * Add index pattern migration to dashboards * Add references mapping to dashboard mppings.json * Remove findRelationships from repository and into it's own function / file * Apply PR feedback pt1 * Fix some failing tests * Remove error throwing in migrations * Add references to edit saved object screen * Pass types to findRelationships * [ftr] restore snapshots from master, rely on migrations to add references * [security] remove `find_relationships` action * remove data set modifications * [security/savedObjectsClient] remove _getAuthorizedTypes method * fix security & spaces tests to consider references and migrationVersion * Add space id prefixes to es_archiver/saved_objects/spaces/data.json * Rename referenced attributes to have a suffix of RefName * Fix length check in scenario references doesn't exist * Add test for inject references to not be called when references array is empty or missing * some code cleanup * Make migrations run on machine learning data files, fix rollup filterPath for savedSearchRefName * fix broken test * Fix collector.js to include references in elasticsearch response * code cleanup pt2 * add some more tests * fix broken tests * updated documentation on referencedBy option for saved object client find function * Move visualization migrations into kibana plugin * Update docs with better description on references * Apply PR feedback * Fix merge * fix tests I broke adressing PR feedback * PR feedback pt2
107 lines
2.9 KiB
Text
107 lines
2.9 KiB
Text
[[saved-objects-api-bulk-create]]
|
|
=== Bulk Create Objects
|
|
|
|
experimental[This functionality is *experimental* and may be changed or removed completely in a future release.]
|
|
|
|
The bulk-create saved object API enables you to persist multiple Kibana saved
|
|
objects.
|
|
|
|
Note: You cannot access this endpoint via the Console in Kibana.
|
|
|
|
==== Request
|
|
|
|
`POST /api/saved_objects/_bulk_create`
|
|
|
|
|
|
==== Query Parameters
|
|
|
|
`overwrite` (optional)::
|
|
(boolean) If true, will overwrite the document with the same ID.
|
|
|
|
|
|
==== Request Body
|
|
|
|
The request body must be a JSON array containing objects, each of which
|
|
contains the following properties:
|
|
|
|
`type` (required)::
|
|
(string) Valid options, include: `visualization`, `dashboard`, `search`, `index-pattern`, `config`, and `timelion-sheet`
|
|
|
|
`id` (optional)::
|
|
(string) Enables specifying an ID to use, as opposed to one being randomly generated
|
|
|
|
`attributes` (required)::
|
|
(object) The data to persist
|
|
|
|
`references` (optional)::
|
|
(array) An array of objects with `name`, `id`, and `type` properties that describe the other saved objects this object references. The `name` can be used in the attributes to refer to the other saved object, but never the `id`, which may be updated automatically in the future during migrations or import/export.
|
|
|
|
`version` (optional)::
|
|
(number) Enables specifying a version
|
|
|
|
|
|
==== Response body
|
|
|
|
The response body will have a top level `saved_objects` property that contains
|
|
an array of objects, which 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.
|
|
|
|
For any saved object that could not be persisted, an error object will exist in its
|
|
place.
|
|
|
|
|
|
==== Examples
|
|
|
|
The following example attempts to persist an index pattern with id
|
|
`my-pattern` and a dashboard with id `my-dashboard`, but only the index pattern
|
|
could be persisted because there was an id collision with `my-dashboard` as a saved object with that id alread exists.
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
POST api/saved_objects/_bulk_create
|
|
[
|
|
{
|
|
"type": "index-pattern",
|
|
"id": "my-pattern",
|
|
"attributes": {
|
|
"title": "my-pattern-*"
|
|
}
|
|
},
|
|
{
|
|
"type": "dashboard",
|
|
"id": "my-dashboard",
|
|
"attributes": {
|
|
"title": "Look at my dashboard"
|
|
}
|
|
}
|
|
]
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
A successful call returns a response code of `200` and a response body
|
|
containing a JSON structure similar to the following example:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"saved_objects": [
|
|
{
|
|
"id": "my-pattern",
|
|
"type": "index-pattern",
|
|
"version": 1,
|
|
"attributes": {
|
|
"title": "my-pattern-*"
|
|
}
|
|
},
|
|
{
|
|
"id": "my-dashboard",
|
|
"type": "dashboard",
|
|
"error": {
|
|
"statusCode": 409,
|
|
"message": "version conflict, document already exists"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
--------------------------------------------------
|