[OAS] Migrate _export and _import APIs to code-first OAS (#217146)

## Summary

* Removes manually maintained OAS for Core's `_export` and `_import`
Saved Object APIs
* seeks to remove some code duplication and move our OAS descriptions
closer to the code definitions.
This commit is contained in:
Jean-Louis Leysens 2025-04-07 11:45:47 +02:00 committed by GitHub
parent afad46b89a
commit 135b57bbac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 1439 additions and 1712 deletions

View file

@ -8,7 +8,18 @@ source .buildkite/scripts/common/util.sh
.buildkite/scripts/copy_es_snapshot_cache.sh
echo --- Capture OAS snapshot
cmd="node scripts/capture_oas_snapshot --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/dashboards"
cmd="node scripts/capture_oas_snapshot \
--include-path /api/status \
--include-path /api/alerting/rule/ \
--include-path /api/alerting/rules \
--include-path /api/actions \
--include-path /api/security/role \
--include-path /api/spaces \
--include-path /api/streams \
--include-path /api/fleet \
--include-path /api/dashboards \
--include-path /api/saved_objects/_import \
--include-path /api/saved_objects/_export"
if is_pr && ! is_auto_commit_disabled; then
cmd="$cmd --update"
fi

View file

@ -44421,6 +44421,407 @@
]
}
},
"/api/saved_objects/_export": {
"post": {
"description": "Retrieve sets of saved objects that you want to import into Kibana. You must include `type` or `objects` in the request body.\n\nExported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.\n\nNOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.",
"operationId": "post-saved-objects-export",
"parameters": [
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
"name": "kbn-xsrf",
"required": true,
"schema": {
"example": "true",
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"examples": {
"exportSavedObjectsRequest": {
"summary": "Export a specific saved object.",
"value": {
"excludeExportDetails": true,
"includeReferencesDeep": false,
"objects": [
{
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2",
"type": "map"
}
]
}
}
},
"schema": {
"additionalProperties": false,
"properties": {
"excludeExportDetails": {
"default": false,
"description": "Do not add export details entry at the end of the stream.",
"type": "boolean"
},
"hasReference": {
"anyOf": [
{
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"type",
"id"
],
"type": "object"
},
{
"items": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"type",
"id"
],
"type": "object"
},
"type": "array"
}
]
},
"includeReferencesDeep": {
"default": false,
"description": "Includes all of the referenced objects in the exported objects.",
"type": "boolean"
},
"objects": {
"description": "A list of objects to export. NOTE: this optiona cannot be combined with `types` option",
"items": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"type",
"id"
],
"type": "object"
},
"maxItems": 10000,
"type": "array"
},
"search": {
"description": "Search for documents to export using the Elasticsearch Simple Query String syntax.",
"type": "string"
},
"type": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"description": "The saved object types to include in the export. Use `*` to export all the types."
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"content": {
"application/x-ndjson": {
"examples": {
"exportSavedObjectsResponse": {
"summary": "The export objects API response contains a JSON record for each exported object.",
"value": {
"attributes": {
"description": "",
"layerListJSON": "[{\"id\":\"0hmz5\",\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"visible\":true,\"style\":{},\"type\":\"EMS_VECTOR_TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"edh66\",\"label\":\"Total Requests by Destination\",\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.5,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"world_countries\",\"tooltipProperties\":[\"name\",\"iso2\"]},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e\",\"origin\":\"join\"},\"color\":\"Greys\",\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\",\"joins\":[{\"leftField\":\"iso2\",\"right\":{\"type\":\"ES_TERM_SOURCE\",\"id\":\"673ff994-fc75-4c67-909b-69fcb0e1060e\",\"indexPatternTitle\":\"kibana_sample_data_logs\",\"term\":\"geo.dest\",\"indexPatternRefName\":\"layer_1_join_0_index_pattern\",\"metrics\":[{\"type\":\"count\",\"label\":\"web logs count\"}],\"applyGlobalQuery\":true}}]},{\"id\":\"gaxya\",\"label\":\"Actual Requests\",\"minZoom\":9,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"id\":\"b7486535-171b-4d3b-bb2e-33c1a0a2854c\",\"type\":\"ES_SEARCH\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[\"clientip\",\"timestamp\",\"host\",\"request\",\"response\",\"machine.os\",\"agent\",\"bytes\"],\"indexPatternRefName\":\"layer_2_source_index_pattern\",\"applyGlobalQuery\":true,\"scalingType\":\"LIMIT\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#2200ff\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":2}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"bytes\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":23,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\"},{\"id\":\"tfi3f\",\"label\":\"Total Requests and Bytes\",\"minZoom\":0,\"maxZoom\":9,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"resolution\":\"COARSE\",\"id\":\"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b\",\"geoField\":\"geo.coordinates\",\"requestType\":\"point\",\"metrics\":[{\"type\":\"count\",\"label\":\"web logs count\"},{\"type\":\"sum\",\"field\":\"bytes\"}],\"indexPatternRefName\":\"layer_3_source_index_pattern\",\"applyGlobalQuery\":true},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Blues\",\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#cccccc\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"sum_of_bytes\",\"origin\":\"source\"},\"minSize\":7,\"maxSize\":25,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"labelText\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"labelSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"minSize\":12,\"maxSize\":24,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\"}]",
"mapStateJSON": "{\"zoom\":3.64,\"center\":{\"lon\":-88.92107,\"lat\":42.16337},\"timeFilters\":{\"from\":\"now-7d\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":0},\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"settings\":{\"autoFitToDataBounds\":false}}",
"title": "[Logs] Total Requests and Bytes",
"uiStateJSON": "{\"isDarkMode\":false}"
},
"coreMigrationVersion": "8.8.0",
"created_at": "2023-08-23T20:03:32.204Z",
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2",
"managed": false,
"references": [
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_1_join_0_index_pattern",
"type": "index-pattern"
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_2_source_index_pattern",
"type": "index-pattern"
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_3_source_index_pattern",
"type": "index-pattern"
}
],
"type": "map",
"typeMigrationVersion": "8.4.0",
"updated_at": "2023-08-23T20:03:32.204Z",
"version": "WzEzLDFd"
}
}
},
"schema": {}
}
},
"description": "Indicates a successfull call."
},
"400": {
"content": {
"application/json": {
"schema": {
"additionalProperties": false,
"description": "Indicates an unsuccessful response.",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
},
"statusCode": {
"enum": [
400
],
"type": "integer"
}
},
"required": [
"error",
"message",
"statusCode"
],
"type": "object"
}
}
},
"description": "Bad request."
}
},
"summary": "Export saved objects",
"tags": [
"saved objects"
]
}
},
"/api/saved_objects/_import": {
"post": {
"description": "Create sets of Kibana saved objects from a file created by the export API. Saved objects can only be imported into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.",
"operationId": "post-saved-objects-import",
"parameters": [
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
"name": "kbn-xsrf",
"required": true,
"schema": {
"example": "true",
"type": "string"
}
},
{
"description": "Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.",
"in": "query",
"name": "overwrite",
"required": false,
"schema": {
"default": false,
"type": "boolean"
}
},
{
"description": "Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.",
"in": "query",
"name": "createNewCopies",
"required": false,
"schema": {
"default": false,
"type": "boolean"
}
},
{
"description": "Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.",
"in": "query",
"name": "compatibilityMode",
"required": false,
"schema": {
"default": false,
"type": "boolean"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"examples": {
"importObjectsRequest": {
"value": {
"file": "file.ndjson"
}
}
},
"schema": {
"additionalProperties": false,
"properties": {
"file": {
"description": "A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.",
"type": "object"
}
},
"required": [
"file"
],
"type": "object"
}
}
}
},
"responses": {
"200": {
"content": {
"application/json": {
"examples": {
"importObjectsResponse": {
"summary": "The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.",
"value": {
"success": true,
"successCount": 1,
"successResults": [
{
"destinationId": "82d2760c-468f-49cf-83aa-b9a35b6a8943",
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"managed": false,
"meta": {
"icon": "indexPatternApp",
"title": "Kibana Sample Data Logs"
},
"type": "index-pattern"
}
]
}
}
},
"schema": {
"additionalProperties": false,
"properties": {
"errors": {
"description": "Indicates the import was unsuccessful and specifies the objects that failed to import.\n\nNOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.",
"items": {
"additionalProperties": true,
"properties": {},
"type": "object"
},
"type": "array"
},
"success": {
"description": "Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.",
"type": "boolean"
},
"successCount": {
"description": "Indicates the number of successfully imported records.",
"type": "number"
},
"successResults": {
"description": "Indicates the objects that are successfully imported, with any metadata if applicable.\n\nNOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.",
"items": {
"additionalProperties": true,
"properties": {},
"type": "object"
},
"type": "array"
}
},
"required": [
"success",
"successCount",
"errors",
"successResults"
],
"type": "object"
}
}
},
"description": "Indicates a successful call."
},
"400": {
"content": {
"application/json": {
"schema": {
"additionalProperties": false,
"description": "Indicates an unsuccessful response.",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
},
"statusCode": {
"enum": [
400
],
"type": "integer"
}
},
"required": [
"error",
"message",
"statusCode"
],
"type": "object"
}
}
},
"description": "Bad request."
}
},
"summary": "Import saved objects",
"tags": [
"saved objects"
],
"x-codeSamples": [
{
"label": "Import with createNewCopies",
"lang": "cURL",
"source": "curl \\\n -X POST api/saved_objects/_import?createNewCopies=true\n -H \"kbn-xsrf: true\"\n --form file=@file.ndjson\n"
}
]
}
},
"/api/security/role": {
"get": {
"operationId": "get-security-role",
@ -53490,6 +53891,9 @@
{
"name": "roles"
},
{
"name": "saved objects"
},
{
"name": "spaces"
},

View file

@ -44421,6 +44421,407 @@
]
}
},
"/api/saved_objects/_export": {
"post": {
"description": "Retrieve sets of saved objects that you want to import into Kibana. You must include `type` or `objects` in the request body.\n\nExported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.\n\nNOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.",
"operationId": "post-saved-objects-export",
"parameters": [
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
"name": "kbn-xsrf",
"required": true,
"schema": {
"example": "true",
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"examples": {
"exportSavedObjectsRequest": {
"summary": "Export a specific saved object.",
"value": {
"excludeExportDetails": true,
"includeReferencesDeep": false,
"objects": [
{
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2",
"type": "map"
}
]
}
}
},
"schema": {
"additionalProperties": false,
"properties": {
"excludeExportDetails": {
"default": false,
"description": "Do not add export details entry at the end of the stream.",
"type": "boolean"
},
"hasReference": {
"anyOf": [
{
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"type",
"id"
],
"type": "object"
},
{
"items": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"type",
"id"
],
"type": "object"
},
"type": "array"
}
]
},
"includeReferencesDeep": {
"default": false,
"description": "Includes all of the referenced objects in the exported objects.",
"type": "boolean"
},
"objects": {
"description": "A list of objects to export. NOTE: this optiona cannot be combined with `types` option",
"items": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"type",
"id"
],
"type": "object"
},
"maxItems": 10000,
"type": "array"
},
"search": {
"description": "Search for documents to export using the Elasticsearch Simple Query String syntax.",
"type": "string"
},
"type": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"description": "The saved object types to include in the export. Use `*` to export all the types."
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"content": {
"application/x-ndjson": {
"examples": {
"exportSavedObjectsResponse": {
"summary": "The export objects API response contains a JSON record for each exported object.",
"value": {
"attributes": {
"description": "",
"layerListJSON": "[{\"id\":\"0hmz5\",\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"visible\":true,\"style\":{},\"type\":\"EMS_VECTOR_TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"edh66\",\"label\":\"Total Requests by Destination\",\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.5,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"world_countries\",\"tooltipProperties\":[\"name\",\"iso2\"]},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e\",\"origin\":\"join\"},\"color\":\"Greys\",\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\",\"joins\":[{\"leftField\":\"iso2\",\"right\":{\"type\":\"ES_TERM_SOURCE\",\"id\":\"673ff994-fc75-4c67-909b-69fcb0e1060e\",\"indexPatternTitle\":\"kibana_sample_data_logs\",\"term\":\"geo.dest\",\"indexPatternRefName\":\"layer_1_join_0_index_pattern\",\"metrics\":[{\"type\":\"count\",\"label\":\"web logs count\"}],\"applyGlobalQuery\":true}}]},{\"id\":\"gaxya\",\"label\":\"Actual Requests\",\"minZoom\":9,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"id\":\"b7486535-171b-4d3b-bb2e-33c1a0a2854c\",\"type\":\"ES_SEARCH\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[\"clientip\",\"timestamp\",\"host\",\"request\",\"response\",\"machine.os\",\"agent\",\"bytes\"],\"indexPatternRefName\":\"layer_2_source_index_pattern\",\"applyGlobalQuery\":true,\"scalingType\":\"LIMIT\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#2200ff\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":2}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"bytes\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":23,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\"},{\"id\":\"tfi3f\",\"label\":\"Total Requests and Bytes\",\"minZoom\":0,\"maxZoom\":9,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"resolution\":\"COARSE\",\"id\":\"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b\",\"geoField\":\"geo.coordinates\",\"requestType\":\"point\",\"metrics\":[{\"type\":\"count\",\"label\":\"web logs count\"},{\"type\":\"sum\",\"field\":\"bytes\"}],\"indexPatternRefName\":\"layer_3_source_index_pattern\",\"applyGlobalQuery\":true},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Blues\",\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#cccccc\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"sum_of_bytes\",\"origin\":\"source\"},\"minSize\":7,\"maxSize\":25,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"labelText\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"labelSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"minSize\":12,\"maxSize\":24,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\"}]",
"mapStateJSON": "{\"zoom\":3.64,\"center\":{\"lon\":-88.92107,\"lat\":42.16337},\"timeFilters\":{\"from\":\"now-7d\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":0},\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"settings\":{\"autoFitToDataBounds\":false}}",
"title": "[Logs] Total Requests and Bytes",
"uiStateJSON": "{\"isDarkMode\":false}"
},
"coreMigrationVersion": "8.8.0",
"created_at": "2023-08-23T20:03:32.204Z",
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2",
"managed": false,
"references": [
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_1_join_0_index_pattern",
"type": "index-pattern"
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_2_source_index_pattern",
"type": "index-pattern"
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_3_source_index_pattern",
"type": "index-pattern"
}
],
"type": "map",
"typeMigrationVersion": "8.4.0",
"updated_at": "2023-08-23T20:03:32.204Z",
"version": "WzEzLDFd"
}
}
},
"schema": {}
}
},
"description": "Indicates a successfull call."
},
"400": {
"content": {
"application/json": {
"schema": {
"additionalProperties": false,
"description": "Indicates an unsuccessful response.",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
},
"statusCode": {
"enum": [
400
],
"type": "integer"
}
},
"required": [
"error",
"message",
"statusCode"
],
"type": "object"
}
}
},
"description": "Bad request."
}
},
"summary": "Export saved objects",
"tags": [
"saved objects"
]
}
},
"/api/saved_objects/_import": {
"post": {
"description": "Create sets of Kibana saved objects from a file created by the export API. Saved objects can only be imported into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.",
"operationId": "post-saved-objects-import",
"parameters": [
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
"name": "kbn-xsrf",
"required": true,
"schema": {
"example": "true",
"type": "string"
}
},
{
"description": "Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.",
"in": "query",
"name": "overwrite",
"required": false,
"schema": {
"default": false,
"type": "boolean"
}
},
{
"description": "Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.",
"in": "query",
"name": "createNewCopies",
"required": false,
"schema": {
"default": false,
"type": "boolean"
}
},
{
"description": "Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.",
"in": "query",
"name": "compatibilityMode",
"required": false,
"schema": {
"default": false,
"type": "boolean"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"examples": {
"importObjectsRequest": {
"value": {
"file": "file.ndjson"
}
}
},
"schema": {
"additionalProperties": false,
"properties": {
"file": {
"description": "A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.",
"type": "object"
}
},
"required": [
"file"
],
"type": "object"
}
}
}
},
"responses": {
"200": {
"content": {
"application/json": {
"examples": {
"importObjectsResponse": {
"summary": "The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.",
"value": {
"success": true,
"successCount": 1,
"successResults": [
{
"destinationId": "82d2760c-468f-49cf-83aa-b9a35b6a8943",
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"managed": false,
"meta": {
"icon": "indexPatternApp",
"title": "Kibana Sample Data Logs"
},
"type": "index-pattern"
}
]
}
}
},
"schema": {
"additionalProperties": false,
"properties": {
"errors": {
"description": "Indicates the import was unsuccessful and specifies the objects that failed to import.\n\nNOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.",
"items": {
"additionalProperties": true,
"properties": {},
"type": "object"
},
"type": "array"
},
"success": {
"description": "Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.",
"type": "boolean"
},
"successCount": {
"description": "Indicates the number of successfully imported records.",
"type": "number"
},
"successResults": {
"description": "Indicates the objects that are successfully imported, with any metadata if applicable.\n\nNOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.",
"items": {
"additionalProperties": true,
"properties": {},
"type": "object"
},
"type": "array"
}
},
"required": [
"success",
"successCount",
"errors",
"successResults"
],
"type": "object"
}
}
},
"description": "Indicates a successful call."
},
"400": {
"content": {
"application/json": {
"schema": {
"additionalProperties": false,
"description": "Indicates an unsuccessful response.",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
},
"statusCode": {
"enum": [
400
],
"type": "integer"
}
},
"required": [
"error",
"message",
"statusCode"
],
"type": "object"
}
}
},
"description": "Bad request."
}
},
"summary": "Import saved objects",
"tags": [
"saved objects"
],
"x-codeSamples": [
{
"label": "Import with createNewCopies",
"lang": "cURL",
"source": "curl \\\n -X POST api/saved_objects/_import?createNewCopies=true\n -H \"kbn-xsrf: true\"\n --form file=@file.ndjson\n"
}
]
}
},
"/api/security/role": {
"get": {
"operationId": "get-security-role",
@ -53081,6 +53482,9 @@
{
"name": "roles"
},
{
"name": "saved objects"
},
{
"name": "spaces"
},

View file

@ -46,7 +46,7 @@ security:
tags:
- name: alerting
description: |
Alerting enables you to define rules, which detect complex conditions within your data. When a condition is met, the rule tracks it as an alert and runs the actions that are defined in the rule. Actions typically involve the use of connectors to interact with Kibana services or third party integrations.
Alerting enables you to define rules, which detect complex conditions within your data. When a condition is met, the rule tracks it as an alert and runs the actions that are defined in the rule. Actions typically involve the use of connectors to interact with Kibana services or third party integrations.
externalDocs:
description: Alerting documentation
url: https://www.elastic.co/docs/current/serverless/rules
@ -102,17 +102,15 @@ tags:
externalDocs:
description: Kibana role management
url: https://www.elastic.co/guide/en/kibana/master/kibana-role-management.html
- description: |
Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.
- name: saved objects
x-displayName: Saved objects
description: |
Export or import sets of saved objects.
To manage a specific type of saved object, use the corresponding APIs.
For example, use:
[Data views](../group/endpoint-data-views)
Warning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions.
name: saved objects
x-displayName: Saved objects
[Data views](../group/endpoint-data-views).
- description: Manage and interact with Security Assistant resources.
name: Security AI Assistant API
x-displayName: Security AI assistant
@ -41072,146 +41070,275 @@ paths:
- Security Entity Analytics API
/api/saved_objects/_export:
post:
description: |
Retrieve sets of saved objects that you want to import into Kibana.
You must include `type` or `objects` in the request body.
description: |-
Retrieve sets of saved objects that you want to import into Kibana. You must include `type` or `objects` in the request body.
Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.
operationId: exportSavedObjectsDefault
operationId: post-saved-objects-export
parameters:
- $ref: '#/components/parameters/Serverless_saved_objects_kbn_xsrf'
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
required: true
schema:
example: 'true'
type: string
requestBody:
content:
application/json:
examples:
exportSavedObjectsRequest:
$ref: '#/components/examples/Serverless_saved_objects_export_objects_request'
summary: Export a specific saved object.
value:
excludeExportDetails: true
includeReferencesDeep: false
objects:
- id: de71f4f0-1902-11e9-919b-ffe5949a18d2
type: map
schema:
additionalProperties: false
type: object
properties:
excludeExportDetails:
default: false
description: Do not add export details entry at the end of the stream.
type: boolean
hasReference:
anyOf:
- additionalProperties: false
type: object
properties:
id:
type: string
type:
type: string
required:
- type
- id
- items:
additionalProperties: false
type: object
properties:
id:
type: string
type:
type: string
required:
- type
- id
type: array
includeReferencesDeep:
default: false
description: Includes all of the referenced objects in the exported objects.
type: boolean
objects:
description: A list of objects to export.
description: 'A list of objects to export. NOTE: this optiona cannot be combined with `types` option'
items:
additionalProperties: false
type: object
properties:
id:
type: string
type:
type: string
required:
- type
- id
maxItems: 10000
type: array
search:
description: Search for documents to export using the Elasticsearch Simple Query String syntax.
type: string
type:
description: The saved object types to include in the export. Use `*` to export all the types.
oneOf:
anyOf:
- type: string
- items:
type: string
type: array
required: true
description: The saved object types to include in the export. Use `*` to export all the types.
responses:
'200':
content:
application/x-ndjson:
examples:
exportSavedObjectsResponse:
$ref: '#/components/examples/Serverless_saved_objects_export_objects_response'
schema:
additionalProperties: true
type: object
description: Indicates a successful call.
summary: The export objects API response contains a JSON record for each exported object.
value:
attributes:
description: ''
layerListJSON: '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","isAutoSelect":true,"lightModeDefault":"road_map_desaturated"},"visible":true,"style":{},"type":"EMS_VECTOR_TILE","minZoom":0,"maxZoom":24},{"id":"edh66","label":"Total Requests by Destination","minZoom":0,"maxZoom":24,"alpha":0.5,"sourceDescriptor":{"type":"EMS_FILE","id":"world_countries","tooltipProperties":["name","iso2"]},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e","origin":"join"},"color":"Greys","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR","joins":[{"leftField":"iso2","right":{"type":"ES_TERM_SOURCE","id":"673ff994-fc75-4c67-909b-69fcb0e1060e","indexPatternTitle":"kibana_sample_data_logs","term":"geo.dest","indexPatternRefName":"layer_1_join_0_index_pattern","metrics":[{"type":"count","label":"web logs count"}],"applyGlobalQuery":true}}]},{"id":"gaxya","label":"Actual Requests","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"b7486535-171b-4d3b-bb2e-33c1a0a2854c","type":"ES_SEARCH","geoField":"geo.coordinates","limit":2048,"filterByMapBounds":true,"tooltipProperties":["clientip","timestamp","host","request","response","machine.os","agent","bytes"],"indexPatternRefName":"layer_2_source_index_pattern","applyGlobalQuery":true,"scalingType":"LIMIT"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"STATIC","options":{"color":"#2200ff"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":2}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"bytes","origin":"source"},"minSize":1,"maxSize":23,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"},{"id":"tfi3f","label":"Total Requests and Bytes","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b","geoField":"geo.coordinates","requestType":"point","metrics":[{"type":"count","label":"web logs count"},{"type":"sum","field":"bytes"}],"indexPatternRefName":"layer_3_source_index_pattern","applyGlobalQuery":true},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"color":"Blues","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#cccccc"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"sum_of_bytes","origin":"source"},"minSize":7,"maxSize":25,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelText":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelSize":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"minSize":12,"maxSize":24,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"}]'
mapStateJSON: '{"zoom":3.64,"center":{"lon":-88.92107,"lat":42.16337},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"language":"kuery","query":""},"settings":{"autoFitToDataBounds":false}}'
title: '[Logs] Total Requests and Bytes'
uiStateJSON: '{"isDarkMode":false}'
coreMigrationVersion: 8.8.0
created_at: '2023-08-23T20:03:32.204Z'
id: de71f4f0-1902-11e9-919b-ffe5949a18d2
managed: false
references:
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_1_join_0_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_2_source_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_3_source_index_pattern
type: index-pattern
type: map
typeMigrationVersion: 8.4.0
updated_at: '2023-08-23T20:03:32.204Z'
version: WzEzLDFd
schema: {}
description: Indicates a successfull call.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Serverless_saved_objects_400_response'
additionalProperties: false
description: Indicates an unsuccessful response.
type: object
properties:
error:
type: string
message:
type: string
statusCode:
enum:
- 400
type: integer
required:
- error
- message
- statusCode
description: Bad request.
summary: Export saved objects
tags:
- saved objects
/api/saved_objects/_import:
post:
description: |
Create sets of Kibana saved objects from a file created by the export API.
Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
operationId: importSavedObjectsDefault
description: Create sets of Kibana saved objects from a file created by the export API. Saved objects can only be imported into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
operationId: post-saved-objects-import
parameters:
- $ref: '#/components/parameters/Serverless_saved_objects_kbn_xsrf'
- description: |
Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.
in: query
name: createNewCopies
required: false
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
required: true
schema:
type: boolean
- description: |
Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.
example: 'true'
type: string
- description: 'Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.'
in: query
name: overwrite
required: false
schema:
default: false
type: boolean
- description: |
Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.
- description: 'Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.'
in: query
name: createNewCopies
required: false
schema:
default: false
type: boolean
- description: 'Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.'
in: query
name: compatibilityMode
required: false
schema:
default: false
type: boolean
requestBody:
content:
multipart/form-data:
examples:
importObjectsRequest:
$ref: '#/components/examples/Serverless_saved_objects_import_objects_request'
value:
file: file.ndjson
schema:
additionalProperties: false
type: object
properties:
file:
description: |
A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.
required: true
description: 'A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.'
type: object
required:
- file
responses:
'200':
content:
application/json:
examples:
importObjectsResponse:
$ref: '#/components/examples/Serverless_saved_objects_import_objects_response'
summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.
value:
success: true
successCount: 1
successResults:
- destinationId: 82d2760c-468f-49cf-83aa-b9a35b6a8943
id: 90943e30-9a47-11e8-b64d-95841ca0b247
managed: false
meta:
icon: indexPatternApp
title: Kibana Sample Data Logs
type: index-pattern
schema:
additionalProperties: false
type: object
properties:
errors:
description: |
description: |-
Indicates the import was unsuccessful and specifies the objects that failed to import.
NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.
items:
additionalProperties: true
type: object
properties: {}
type: array
success:
description: |
Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
description: Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
type: boolean
successCount:
description: Indicates the number of successfully imported records.
type: integer
type: number
successResults:
description: |
description: |-
Indicates the objects that are successfully imported, with any metadata if applicable.
NOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.
items:
additionalProperties: true
type: object
properties: {}
type: array
required:
- success
- successCount
- errors
- successResults
description: Indicates a successful call.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Serverless_saved_objects_400_response'
additionalProperties: false
description: Indicates an unsuccessful response.
type: object
properties:
error:
type: string
message:
type: string
statusCode:
enum:
- 400
type: integer
required:
- error
- message
- statusCode
description: Bad request.
summary: Import saved objects
tags:
@ -50246,57 +50373,6 @@ components:
myjob2:
success: true
savedObjectsDeleted: {}
Serverless_saved_objects_export_objects_request:
summary: Export a specific saved object.
value:
excludeExportDetails: true
includeReferencesDeep: false
objects:
- id: de71f4f0-1902-11e9-919b-ffe5949a18d2
type: map
Serverless_saved_objects_export_objects_response:
summary: The export objects API response contains a JSON record for each exported object.
value:
attributes:
description: ''
layerListJSON: '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","isAutoSelect":true,"lightModeDefault":"road_map_desaturated"},"visible":true,"style":{},"type":"EMS_VECTOR_TILE","minZoom":0,"maxZoom":24},{"id":"edh66","label":"Total Requests by Destination","minZoom":0,"maxZoom":24,"alpha":0.5,"sourceDescriptor":{"type":"EMS_FILE","id":"world_countries","tooltipProperties":["name","iso2"]},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e","origin":"join"},"color":"Greys","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR","joins":[{"leftField":"iso2","right":{"type":"ES_TERM_SOURCE","id":"673ff994-fc75-4c67-909b-69fcb0e1060e","indexPatternTitle":"kibana_sample_data_logs","term":"geo.dest","indexPatternRefName":"layer_1_join_0_index_pattern","metrics":[{"type":"count","label":"web logs count"}],"applyGlobalQuery":true}}]},{"id":"gaxya","label":"Actual Requests","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"b7486535-171b-4d3b-bb2e-33c1a0a2854c","type":"ES_SEARCH","geoField":"geo.coordinates","limit":2048,"filterByMapBounds":true,"tooltipProperties":["clientip","timestamp","host","request","response","machine.os","agent","bytes"],"indexPatternRefName":"layer_2_source_index_pattern","applyGlobalQuery":true,"scalingType":"LIMIT"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"STATIC","options":{"color":"#2200ff"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":2}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"bytes","origin":"source"},"minSize":1,"maxSize":23,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"},{"id":"tfi3f","label":"Total Requests and Bytes","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b","geoField":"geo.coordinates","requestType":"point","metrics":[{"type":"count","label":"web logs count"},{"type":"sum","field":"bytes"}],"indexPatternRefName":"layer_3_source_index_pattern","applyGlobalQuery":true},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"color":"Blues","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#cccccc"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"sum_of_bytes","origin":"source"},"minSize":7,"maxSize":25,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelText":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelSize":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"minSize":12,"maxSize":24,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"}]'
mapStateJSON: '{"zoom":3.64,"center":{"lon":-88.92107,"lat":42.16337},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"language":"kuery","query":""},"settings":{"autoFitToDataBounds":false}}'
title: '[Logs] Total Requests and Bytes'
uiStateJSON: '{"isDarkMode":false}'
coreMigrationVersion: 8.8.0
created_at: '2023-08-23T20:03:32.204Z'
id: de71f4f0-1902-11e9-919b-ffe5949a18d2
managed: false
references:
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_1_join_0_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_2_source_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_3_source_index_pattern
type: index-pattern
type: map
typeMigrationVersion: 8.4.0
updated_at: '2023-08-23T20:03:32.204Z'
version: WzEzLDFd
Serverless_saved_objects_import_objects_request:
value:
file: file.ndjson
Serverless_saved_objects_import_objects_response:
summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.
value:
success: true
successCount: 1
successResults:
- destinationId: 82d2760c-468f-49cf-83aa-b9a35b6a8943
id: 90943e30-9a47-11e8-b64d-95841ca0b247
managed: false
meta:
icon: indexPatternApp
title: Kibana Sample Data Logs
type: index-pattern
Task_manager_health_Serverless_APIs_health_200response_serverless:
description: A successful response from `GET api/task_manager/_health`.
value: |-
@ -51090,13 +51166,6 @@ components:
required: false
schema:
type: boolean
Serverless_saved_objects_kbn_xsrf:
description: Cross-site request forgery protection
in: header
name: kbn-xsrf
required: true
schema:
type: string
SLOs_kbn_xsrf:
description: Cross-site request forgery protection
in: header
@ -63842,24 +63911,6 @@ components:
- default
- template
type: string
Serverless_saved_objects_400_response:
title: Bad request
type: object
properties:
error:
enum:
- Bad Request
type: string
message:
type: string
statusCode:
enum:
- 400
type: integer
required:
- error
- message
- statusCode
SLOs_400_response:
title: Bad request
type: object

View file

@ -125,7 +125,9 @@ tags:
externalDocs:
description: Kibana role management
url: https://www.elastic.co/guide/en/kibana/master/kibana-role-management.html
- description: |
- name: saved objects
x-displayName: Saved objects
description: |
Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.
To manage a specific type of saved object, use the corresponding APIs.
@ -135,9 +137,7 @@ tags:
* [Spaces](https://www.elastic.co/guide/en/kibana/current/spaces-api.html)
* [Short URLs](https://www.elastic.co/guide/en/kibana/current/short-urls-api.html)
Warning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions.
name: saved objects
x-displayName: Saved objects
Warning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions
- description: Manage and interact with Security Assistant resources.
name: Security AI Assistant API
x-displayName: Security AI assistant
@ -43639,61 +43639,148 @@ paths:
- saved objects
/api/saved_objects/_export:
post:
description: |
Retrieve sets of saved objects that you want to import into Kibana.
You must include `type` or `objects` in the request body.
description: |-
Retrieve sets of saved objects that you want to import into Kibana. You must include `type` or `objects` in the request body.
Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.
operationId: exportSavedObjectsDefault
operationId: post-saved-objects-export
parameters:
- $ref: '#/components/parameters/Saved_objects_kbn_xsrf'
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
required: true
schema:
example: 'true'
type: string
requestBody:
content:
application/json:
examples:
exportSavedObjectsRequest:
$ref: '#/components/examples/Saved_objects_export_objects_request'
summary: Export a specific saved object.
value:
excludeExportDetails: true
includeReferencesDeep: false
objects:
- id: de71f4f0-1902-11e9-919b-ffe5949a18d2
type: map
schema:
additionalProperties: false
type: object
properties:
excludeExportDetails:
default: false
description: Do not add export details entry at the end of the stream.
type: boolean
hasReference:
anyOf:
- additionalProperties: false
type: object
properties:
id:
type: string
type:
type: string
required:
- type
- id
- items:
additionalProperties: false
type: object
properties:
id:
type: string
type:
type: string
required:
- type
- id
type: array
includeReferencesDeep:
default: false
description: Includes all of the referenced objects in the exported objects.
type: boolean
objects:
description: A list of objects to export.
description: 'A list of objects to export. NOTE: this optiona cannot be combined with `types` option'
items:
additionalProperties: false
type: object
properties:
id:
type: string
type:
type: string
required:
- type
- id
maxItems: 10000
type: array
search:
description: Search for documents to export using the Elasticsearch Simple Query String syntax.
type: string
type:
description: The saved object types to include in the export. Use `*` to export all the types.
oneOf:
anyOf:
- type: string
- items:
type: string
type: array
required: true
description: The saved object types to include in the export. Use `*` to export all the types.
responses:
'200':
content:
application/x-ndjson:
examples:
exportSavedObjectsResponse:
$ref: '#/components/examples/Saved_objects_export_objects_response'
schema:
additionalProperties: true
type: object
description: Indicates a successful call.
summary: The export objects API response contains a JSON record for each exported object.
value:
attributes:
description: ''
layerListJSON: '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","isAutoSelect":true,"lightModeDefault":"road_map_desaturated"},"visible":true,"style":{},"type":"EMS_VECTOR_TILE","minZoom":0,"maxZoom":24},{"id":"edh66","label":"Total Requests by Destination","minZoom":0,"maxZoom":24,"alpha":0.5,"sourceDescriptor":{"type":"EMS_FILE","id":"world_countries","tooltipProperties":["name","iso2"]},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e","origin":"join"},"color":"Greys","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR","joins":[{"leftField":"iso2","right":{"type":"ES_TERM_SOURCE","id":"673ff994-fc75-4c67-909b-69fcb0e1060e","indexPatternTitle":"kibana_sample_data_logs","term":"geo.dest","indexPatternRefName":"layer_1_join_0_index_pattern","metrics":[{"type":"count","label":"web logs count"}],"applyGlobalQuery":true}}]},{"id":"gaxya","label":"Actual Requests","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"b7486535-171b-4d3b-bb2e-33c1a0a2854c","type":"ES_SEARCH","geoField":"geo.coordinates","limit":2048,"filterByMapBounds":true,"tooltipProperties":["clientip","timestamp","host","request","response","machine.os","agent","bytes"],"indexPatternRefName":"layer_2_source_index_pattern","applyGlobalQuery":true,"scalingType":"LIMIT"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"STATIC","options":{"color":"#2200ff"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":2}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"bytes","origin":"source"},"minSize":1,"maxSize":23,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"},{"id":"tfi3f","label":"Total Requests and Bytes","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b","geoField":"geo.coordinates","requestType":"point","metrics":[{"type":"count","label":"web logs count"},{"type":"sum","field":"bytes"}],"indexPatternRefName":"layer_3_source_index_pattern","applyGlobalQuery":true},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"color":"Blues","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#cccccc"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"sum_of_bytes","origin":"source"},"minSize":7,"maxSize":25,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelText":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelSize":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"minSize":12,"maxSize":24,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"}]'
mapStateJSON: '{"zoom":3.64,"center":{"lon":-88.92107,"lat":42.16337},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"language":"kuery","query":""},"settings":{"autoFitToDataBounds":false}}'
title: '[Logs] Total Requests and Bytes'
uiStateJSON: '{"isDarkMode":false}'
coreMigrationVersion: 8.8.0
created_at: '2023-08-23T20:03:32.204Z'
id: de71f4f0-1902-11e9-919b-ffe5949a18d2
managed: false
references:
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_1_join_0_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_2_source_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_3_source_index_pattern
type: index-pattern
type: map
typeMigrationVersion: 8.4.0
updated_at: '2023-08-23T20:03:32.204Z'
version: WzEzLDFd
schema: {}
description: Indicates a successfull call.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Saved_objects_400_response'
additionalProperties: false
description: Indicates an unsuccessful response.
type: object
properties:
error:
type: string
message:
type: string
statusCode:
enum:
- 400
type: integer
required:
- error
- message
- statusCode
description: Bad request.
summary: Export saved objects
tags:
@ -43802,85 +43889,127 @@ paths:
- saved objects
/api/saved_objects/_import:
post:
description: |
Create sets of Kibana saved objects from a file created by the export API.
Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
operationId: importSavedObjectsDefault
description: Create sets of Kibana saved objects from a file created by the export API. Saved objects can only be imported into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
operationId: post-saved-objects-import
parameters:
- $ref: '#/components/parameters/Saved_objects_kbn_xsrf'
- description: |
Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.
in: query
name: createNewCopies
required: false
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
required: true
schema:
type: boolean
- description: |
Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.
example: 'true'
type: string
- description: 'Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.'
in: query
name: overwrite
required: false
schema:
default: false
type: boolean
- description: |
Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.
- description: 'Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.'
in: query
name: createNewCopies
required: false
schema:
default: false
type: boolean
- description: 'Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.'
in: query
name: compatibilityMode
required: false
schema:
default: false
type: boolean
requestBody:
content:
multipart/form-data:
examples:
importObjectsRequest:
$ref: '#/components/examples/Saved_objects_import_objects_request'
value:
file: file.ndjson
schema:
additionalProperties: false
type: object
properties:
file:
description: |
A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.
required: true
description: 'A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.'
type: object
required:
- file
responses:
'200':
content:
application/json:
examples:
importObjectsResponse:
$ref: '#/components/examples/Saved_objects_import_objects_response'
summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.
value:
success: true
successCount: 1
successResults:
- destinationId: 82d2760c-468f-49cf-83aa-b9a35b6a8943
id: 90943e30-9a47-11e8-b64d-95841ca0b247
managed: false
meta:
icon: indexPatternApp
title: Kibana Sample Data Logs
type: index-pattern
schema:
additionalProperties: false
type: object
properties:
errors:
description: |
description: |-
Indicates the import was unsuccessful and specifies the objects that failed to import.
NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.
items:
additionalProperties: true
type: object
properties: {}
type: array
success:
description: |
Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
description: Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
type: boolean
successCount:
description: Indicates the number of successfully imported records.
type: integer
type: number
successResults:
description: |
description: |-
Indicates the objects that are successfully imported, with any metadata if applicable.
NOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.
items:
additionalProperties: true
type: object
properties: {}
type: array
required:
- success
- successCount
- errors
- successResults
description: Indicates a successful call.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Saved_objects_400_response'
additionalProperties: false
description: Indicates an unsuccessful response.
type: object
properties:
error:
type: string
message:
type: string
statusCode:
enum:
- 400
type: integer
required:
- error
- message
- statusCode
description: Bad request.
summary: Import saved objects
tags:
@ -55402,57 +55531,6 @@ components:
myjob2:
success: true
savedObjectsDeleted: {}
Saved_objects_export_objects_request:
summary: Export a specific saved object.
value:
excludeExportDetails: true
includeReferencesDeep: false
objects:
- id: de71f4f0-1902-11e9-919b-ffe5949a18d2
type: map
Saved_objects_export_objects_response:
summary: The export objects API response contains a JSON record for each exported object.
value:
attributes:
description: ''
layerListJSON: '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","isAutoSelect":true,"lightModeDefault":"road_map_desaturated"},"visible":true,"style":{},"type":"EMS_VECTOR_TILE","minZoom":0,"maxZoom":24},{"id":"edh66","label":"Total Requests by Destination","minZoom":0,"maxZoom":24,"alpha":0.5,"sourceDescriptor":{"type":"EMS_FILE","id":"world_countries","tooltipProperties":["name","iso2"]},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e","origin":"join"},"color":"Greys","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR","joins":[{"leftField":"iso2","right":{"type":"ES_TERM_SOURCE","id":"673ff994-fc75-4c67-909b-69fcb0e1060e","indexPatternTitle":"kibana_sample_data_logs","term":"geo.dest","indexPatternRefName":"layer_1_join_0_index_pattern","metrics":[{"type":"count","label":"web logs count"}],"applyGlobalQuery":true}}]},{"id":"gaxya","label":"Actual Requests","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"b7486535-171b-4d3b-bb2e-33c1a0a2854c","type":"ES_SEARCH","geoField":"geo.coordinates","limit":2048,"filterByMapBounds":true,"tooltipProperties":["clientip","timestamp","host","request","response","machine.os","agent","bytes"],"indexPatternRefName":"layer_2_source_index_pattern","applyGlobalQuery":true,"scalingType":"LIMIT"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"STATIC","options":{"color":"#2200ff"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":2}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"bytes","origin":"source"},"minSize":1,"maxSize":23,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"},{"id":"tfi3f","label":"Total Requests and Bytes","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b","geoField":"geo.coordinates","requestType":"point","metrics":[{"type":"count","label":"web logs count"},{"type":"sum","field":"bytes"}],"indexPatternRefName":"layer_3_source_index_pattern","applyGlobalQuery":true},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"color":"Blues","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#cccccc"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"sum_of_bytes","origin":"source"},"minSize":7,"maxSize":25,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelText":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelSize":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"minSize":12,"maxSize":24,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"}]'
mapStateJSON: '{"zoom":3.64,"center":{"lon":-88.92107,"lat":42.16337},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"language":"kuery","query":""},"settings":{"autoFitToDataBounds":false}}'
title: '[Logs] Total Requests and Bytes'
uiStateJSON: '{"isDarkMode":false}'
coreMigrationVersion: 8.8.0
created_at: '2023-08-23T20:03:32.204Z'
id: de71f4f0-1902-11e9-919b-ffe5949a18d2
managed: false
references:
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_1_join_0_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_2_source_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_3_source_index_pattern
type: index-pattern
type: map
typeMigrationVersion: 8.4.0
updated_at: '2023-08-23T20:03:32.204Z'
version: WzEzLDFd
Saved_objects_import_objects_request:
value:
file: file.ndjson
Saved_objects_import_objects_response:
summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.
value:
success: true
successCount: 1
successResults:
- destinationId: 82d2760c-468f-49cf-83aa-b9a35b6a8943
id: 90943e30-9a47-11e8-b64d-95841ca0b247
managed: false
meta:
icon: indexPatternApp
title: Kibana Sample Data Logs
type: index-pattern
Saved_objects_key_rotation_response:
summary: Encryption key rotation using default parameters.
value:

View file

@ -21,7 +21,7 @@ actions:
update:
description: >
Alerting enables you to define rules, which detect complex conditions within your data.
When a condition is met, the rule tracks it as an alert and runs the actions that are defined in the rule.
When a condition is met, the rule tracks it as an alert and runs the actions that are defined in the rule.
Actions typically involve the use of connectors to interact with Kibana services or third party integrations.
externalDocs:
description: Alerting documentation
@ -74,6 +74,17 @@ actions:
x-displayName: "System"
description: >
Get information about the system status, resource usage, and installed plugins.
- target: '$.tags[?(@.name=="saved objects")]'
description: Change displayName and description
update:
x-displayName: "Saved objects"
description: |
Export or import sets of saved objects.
To manage a specific type of saved object, use the corresponding APIs.
For example, use:
[Data views](../group/endpoint-data-views).
# Remove extra tags from operations
- target: "$.paths[*][*].tags[1:]"
description: Remove all but first tag from operations

View file

@ -112,6 +112,21 @@ actions:
description: Change displayName
update:
x-displayName: "User session management"
- target: '$.tags[?(@.name=="saved objects")]'
description: Change displayName and description
update:
x-displayName: "Saved objects"
description: |
Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.
To manage a specific type of saved object, use the corresponding APIs.
For example, use:
* [Data views](../group/endpoint-data-views)
* [Spaces](https://www.elastic.co/guide/en/kibana/current/spaces-api.html)
* [Short URLs](https://www.elastic.co/guide/en/kibana/current/short-urls-api.html)
Warning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions
# Remove extra tags from operations
- target: "$.paths[*][*].tags[1:]"
description: Remove all but first tag from operations

View file

@ -17,7 +17,6 @@ const { REPO_ROOT } = require('@kbn/repo-info');
`${REPO_ROOT}/oas_docs/bundle.serverless.json`,
`${REPO_ROOT}/src/platform/plugins/shared/data_views/docs/openapi/bundled.yaml`,
`${REPO_ROOT}/x-pack/platform/plugins/shared/ml/common/openapi/ml_apis_serverless.yaml`,
`${REPO_ROOT}/src/core/packages/saved-objects/docs/openapi/bundled_serverless.yaml`,
`${REPO_ROOT}/x-pack/platform/plugins/shared/task_manager/docs/openapi/bundled_serverless.yaml`,
// Observability Solution

View file

@ -20,8 +20,6 @@ Generate the `bundled` files by running the following commands:
```bash
npx @redocly/cli bundle entrypoint.yaml --output bundled.yaml --ext yaml
npx @redocly/cli bundle entrypoint.yaml --output bundled.json --ext json
npx @redocly/cli bundle entrypoint_serverless.yaml --output bundled_serverless.yaml --ext yaml
npx @redocly/cli bundle entrypoint_serverless.yaml --output bundled_serverless.json --ext json
```
Then join these files with the rest of the Kibana APIs per `oas_docs/README.md`

View file

@ -17,13 +17,6 @@
"url": "/"
}
],
"tags": [
{
"name": "saved objects",
"x-displayName": "Saved objects",
"description": "Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.\n\nTo manage a specific type of saved object, use the corresponding APIs.\nFor example, use:\n\n* [Data views](../group/endpoint-data-views)\n* [Spaces](https://www.elastic.co/guide/en/kibana/current/spaces-api.html)\n* [Short URLs](https://www.elastic.co/guide/en/kibana/current/short-urls-api.html)\n\nWarning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions.\n"
}
],
"paths": {
"/api/encrypted_saved_objects/_rotate_key": {
"post": {
@ -376,96 +369,6 @@
}
}
},
"/api/saved_objects/_export": {
"post": {
"summary": "Export saved objects",
"operationId": "exportSavedObjectsDefault",
"description": "Retrieve sets of saved objects that you want to import into Kibana.\nYou must include `type` or `objects` in the request body.\n\nExported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.\n\nNOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.\n",
"tags": [
"saved objects"
],
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"excludeExportDetails": {
"description": "Do not add export details entry at the end of the stream.",
"type": "boolean",
"default": false
},
"includeReferencesDeep": {
"description": "Includes all of the referenced objects in the exported objects.",
"type": "boolean"
},
"objects": {
"description": "A list of objects to export.",
"type": "array",
"items": {
"type": "object"
}
},
"type": {
"description": "The saved object types to include in the export. Use `*` to export all the types.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
},
"examples": {
"exportSavedObjectsRequest": {
"$ref": "#/components/examples/export_objects_request"
}
}
}
}
},
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/x-ndjson": {
"schema": {
"type": "object",
"additionalProperties": true
},
"examples": {
"exportSavedObjectsResponse": {
"$ref": "#/components/examples/export_objects_response"
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
}
}
},
"/api/saved_objects/_find": {
"get": {
"summary": "Search for saved objects",
@ -635,126 +538,6 @@
}
}
},
"/api/saved_objects/_import": {
"post": {
"summary": "Import saved objects",
"operationId": "importSavedObjectsDefault",
"description": "Create sets of Kibana saved objects from a file created by the export API.\nSaved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.\n",
"tags": [
"saved objects"
],
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
},
{
"in": "query",
"name": "createNewCopies",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.\n"
},
{
"in": "query",
"name": "overwrite",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.\n"
},
{
"in": "query",
"name": "compatibilityMode",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.\n"
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"file": {
"description": "A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.\n"
}
}
},
"examples": {
"importObjectsRequest": {
"$ref": "#/components/examples/import_objects_request"
}
}
}
}
},
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.\n"
},
"successCount": {
"type": "integer",
"description": "Indicates the number of successfully imported records."
},
"errors": {
"type": "array",
"items": {
"type": "object"
},
"description": "Indicates the import was unsuccessful and specifies the objects that failed to import.\n\nNOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.\n"
},
"successResults": {
"type": "array",
"items": {
"type": "object"
},
"description": "Indicates the objects that are successfully imported, with any metadata if applicable.\n\nNOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.\n"
}
}
},
"examples": {
"importObjectsResponse": {
"$ref": "#/components/examples/import_objects_response"
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
},
"x-codeSamples": [
{
"lang": "cURL",
"label": "Import with createNewCopies",
"source": "curl \\\n -X POST api/saved_objects/_import?createNewCopies=true\n -H \"kbn-xsrf: true\"\n --form file=@file.ndjson\n"
}
]
}
},
"/api/saved_objects/_resolve_import_errors": {
"post": {
"summary": "Resolve import errors",
@ -1217,80 +1000,6 @@
"failed": 0
}
},
"export_objects_request": {
"summary": "Export a specific saved object.",
"value": {
"objects": [
{
"type": "map",
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2"
}
],
"includeReferencesDeep": false,
"excludeExportDetails": true
}
},
"export_objects_response": {
"summary": "The export objects API response contains a JSON record for each exported object.",
"value": {
"attributes": {
"description": "",
"layerListJSON": "[{\"id\":\"0hmz5\",\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"visible\":true,\"style\":{},\"type\":\"EMS_VECTOR_TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"edh66\",\"label\":\"Total Requests by Destination\",\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.5,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"world_countries\",\"tooltipProperties\":[\"name\",\"iso2\"]},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e\",\"origin\":\"join\"},\"color\":\"Greys\",\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\",\"joins\":[{\"leftField\":\"iso2\",\"right\":{\"type\":\"ES_TERM_SOURCE\",\"id\":\"673ff994-fc75-4c67-909b-69fcb0e1060e\",\"indexPatternTitle\":\"kibana_sample_data_logs\",\"term\":\"geo.dest\",\"indexPatternRefName\":\"layer_1_join_0_index_pattern\",\"metrics\":[{\"type\":\"count\",\"label\":\"web logs count\"}],\"applyGlobalQuery\":true}}]},{\"id\":\"gaxya\",\"label\":\"Actual Requests\",\"minZoom\":9,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"id\":\"b7486535-171b-4d3b-bb2e-33c1a0a2854c\",\"type\":\"ES_SEARCH\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[\"clientip\",\"timestamp\",\"host\",\"request\",\"response\",\"machine.os\",\"agent\",\"bytes\"],\"indexPatternRefName\":\"layer_2_source_index_pattern\",\"applyGlobalQuery\":true,\"scalingType\":\"LIMIT\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#2200ff\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":2}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"bytes\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":23,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\"},{\"id\":\"tfi3f\",\"label\":\"Total Requests and Bytes\",\"minZoom\":0,\"maxZoom\":9,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"resolution\":\"COARSE\",\"id\":\"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b\",\"geoField\":\"geo.coordinates\",\"requestType\":\"point\",\"metrics\":[{\"type\":\"count\",\"label\":\"web logs count\"},{\"type\":\"sum\",\"field\":\"bytes\"}],\"indexPatternRefName\":\"layer_3_source_index_pattern\",\"applyGlobalQuery\":true},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Blues\",\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#cccccc\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"sum_of_bytes\",\"origin\":\"source\"},\"minSize\":7,\"maxSize\":25,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"labelText\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"labelSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"minSize\":12,\"maxSize\":24,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\"}]",
"mapStateJSON": "{\"zoom\":3.64,\"center\":{\"lon\":-88.92107,\"lat\":42.16337},\"timeFilters\":{\"from\":\"now-7d\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":0},\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"settings\":{\"autoFitToDataBounds\":false}}",
"title": "[Logs] Total Requests and Bytes",
"uiStateJSON": "{\"isDarkMode\":false}"
},
"coreMigrationVersion": "8.8.0",
"created_at": "2023-08-23T20:03:32.204Z",
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2",
"managed": false,
"references": [
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_1_join_0_index_pattern",
"type": "index-pattern"
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_2_source_index_pattern",
"type": "index-pattern"
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_3_source_index_pattern",
"type": "index-pattern"
}
],
"type": "map",
"typeMigrationVersion": "8.4.0",
"updated_at": "2023-08-23T20:03:32.204Z",
"version": "WzEzLDFd"
}
},
"import_objects_request": {
"value": {
"file": "file.ndjson"
}
},
"import_objects_response": {
"summary": "The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.",
"value": {
"successCount": 1,
"success": true,
"successResults": [
{
"type": "index-pattern",
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"meta": {
"title": "Kibana Sample Data Logs",
"icon": "indexPatternApp"
},
"managed": false,
"destinationId": "82d2760c-468f-49cf-83aa-b9a35b6a8943"
}
]
}
},
"resolve_missing_reference_request": {
"value": {
"file": "file.ndjson",

View file

@ -10,20 +10,6 @@ info:
url: https://www.elastic.co/licensing/elastic-license
servers:
- url: /
tags:
- name: saved objects
x-displayName: Saved objects
description: |
Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.
To manage a specific type of saved object, use the corresponding APIs.
For example, use:
* [Data views](../group/endpoint-data-views)
* [Spaces](https://www.elastic.co/guide/en/kibana/current/spaces-api.html)
* [Short URLs](https://www.elastic.co/guide/en/kibana/current/short-urls-api.html)
Warning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions.
paths:
/api/encrypted_saved_objects/_rotate_key:
post:
@ -259,67 +245,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/400_response'
/api/saved_objects/_export:
post:
summary: Export saved objects
operationId: exportSavedObjectsDefault
description: |
Retrieve sets of saved objects that you want to import into Kibana.
You must include `type` or `objects` in the request body.
Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.
tags:
- saved objects
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
excludeExportDetails:
description: Do not add export details entry at the end of the stream.
type: boolean
default: false
includeReferencesDeep:
description: Includes all of the referenced objects in the exported objects.
type: boolean
objects:
description: A list of objects to export.
type: array
items:
type: object
type:
description: The saved object types to include in the export. Use `*` to export all the types.
oneOf:
- type: string
- type: array
items:
type: string
examples:
exportSavedObjectsRequest:
$ref: '#/components/examples/export_objects_request'
responses:
'200':
description: Indicates a successful call.
content:
application/x-ndjson:
schema:
type: object
additionalProperties: true
examples:
exportSavedObjectsResponse:
$ref: '#/components/examples/export_objects_response'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
/api/saved_objects/_find:
get:
summary: Search for saved objects
@ -422,99 +347,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/400_response'
/api/saved_objects/_import:
post:
summary: Import saved objects
operationId: importSavedObjectsDefault
description: |
Create sets of Kibana saved objects from a file created by the export API.
Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
tags:
- saved objects
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
- in: query
name: createNewCopies
schema:
type: boolean
required: false
description: |
Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.
- in: query
name: overwrite
schema:
type: boolean
required: false
description: |
Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.
- in: query
name: compatibilityMode
schema:
type: boolean
required: false
description: |
Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
description: |
A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.
examples:
importObjectsRequest:
$ref: '#/components/examples/import_objects_request'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
description: |
Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
successCount:
type: integer
description: Indicates the number of successfully imported records.
errors:
type: array
items:
type: object
description: |
Indicates the import was unsuccessful and specifies the objects that failed to import.
NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.
successResults:
type: array
items:
type: object
description: |
Indicates the objects that are successfully imported, with any metadata if applicable.
NOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.
examples:
importObjectsResponse:
$ref: '#/components/examples/import_objects_response'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
x-codeSamples:
- lang: cURL
label: Import with createNewCopies
source: |
curl \
-X POST api/saved_objects/_import?createNewCopies=true
-H "kbn-xsrf: true"
--form file=@file.ndjson
/api/saved_objects/_resolve_import_errors:
post:
summary: Resolve import errors
@ -817,57 +649,6 @@ components:
total: 1000
successful: 300
failed: 0
export_objects_request:
summary: Export a specific saved object.
value:
objects:
- type: map
id: de71f4f0-1902-11e9-919b-ffe5949a18d2
includeReferencesDeep: false
excludeExportDetails: true
export_objects_response:
summary: The export objects API response contains a JSON record for each exported object.
value:
attributes:
description: ''
layerListJSON: '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","isAutoSelect":true,"lightModeDefault":"road_map_desaturated"},"visible":true,"style":{},"type":"EMS_VECTOR_TILE","minZoom":0,"maxZoom":24},{"id":"edh66","label":"Total Requests by Destination","minZoom":0,"maxZoom":24,"alpha":0.5,"sourceDescriptor":{"type":"EMS_FILE","id":"world_countries","tooltipProperties":["name","iso2"]},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e","origin":"join"},"color":"Greys","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR","joins":[{"leftField":"iso2","right":{"type":"ES_TERM_SOURCE","id":"673ff994-fc75-4c67-909b-69fcb0e1060e","indexPatternTitle":"kibana_sample_data_logs","term":"geo.dest","indexPatternRefName":"layer_1_join_0_index_pattern","metrics":[{"type":"count","label":"web logs count"}],"applyGlobalQuery":true}}]},{"id":"gaxya","label":"Actual Requests","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"b7486535-171b-4d3b-bb2e-33c1a0a2854c","type":"ES_SEARCH","geoField":"geo.coordinates","limit":2048,"filterByMapBounds":true,"tooltipProperties":["clientip","timestamp","host","request","response","machine.os","agent","bytes"],"indexPatternRefName":"layer_2_source_index_pattern","applyGlobalQuery":true,"scalingType":"LIMIT"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"STATIC","options":{"color":"#2200ff"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":2}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"bytes","origin":"source"},"minSize":1,"maxSize":23,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"},{"id":"tfi3f","label":"Total Requests and Bytes","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b","geoField":"geo.coordinates","requestType":"point","metrics":[{"type":"count","label":"web logs count"},{"type":"sum","field":"bytes"}],"indexPatternRefName":"layer_3_source_index_pattern","applyGlobalQuery":true},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"color":"Blues","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#cccccc"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"sum_of_bytes","origin":"source"},"minSize":7,"maxSize":25,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelText":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelSize":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"minSize":12,"maxSize":24,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"}]'
mapStateJSON: '{"zoom":3.64,"center":{"lon":-88.92107,"lat":42.16337},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"language":"kuery","query":""},"settings":{"autoFitToDataBounds":false}}'
title: '[Logs] Total Requests and Bytes'
uiStateJSON: '{"isDarkMode":false}'
coreMigrationVersion: 8.8.0
created_at: '2023-08-23T20:03:32.204Z'
id: de71f4f0-1902-11e9-919b-ffe5949a18d2
managed: false
references:
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_1_join_0_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_2_source_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_3_source_index_pattern
type: index-pattern
type: map
typeMigrationVersion: 8.4.0
updated_at: '2023-08-23T20:03:32.204Z'
version: WzEzLDFd
import_objects_request:
value:
file: file.ndjson
import_objects_response:
summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.
value:
successCount: 1
success: true
successResults:
- type: index-pattern
id: 90943e30-9a47-11e8-b64d-95841ca0b247
meta:
title: Kibana Sample Data Logs
icon: indexPatternApp
managed: false
destinationId: 82d2760c-468f-49cf-83aa-b9a35b6a8943
resolve_missing_reference_request:
value:
file: file.ndjson

View file

@ -1,361 +0,0 @@
{
"openapi": "3.0.3",
"info": {
"title": "Serverless saved objects",
"description": "OpenAPI schema for serverless saved object endpoints",
"version": "0.1",
"contact": {
"name": "Kibana Core Team"
},
"license": {
"name": "Elastic License 2.0",
"url": "https://www.elastic.co/licensing/elastic-license"
}
},
"servers": [
{
"url": "https://{kibana_url}",
"variables": {
"kibana_url": {
"default": "localhost:5601"
}
}
}
],
"tags": [
{
"name": "saved objects",
"x-displayName": "Saved objects",
"description": "Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.\n\nTo manage a specific type of saved object, use the corresponding APIs.\nFor example, use:\n\n[Data views](../group/endpoint-data-views)\n\nWarning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions.\n"
}
],
"paths": {
"/api/saved_objects/_export": {
"post": {
"summary": "Export saved objects",
"operationId": "exportSavedObjectsDefault",
"description": "Retrieve sets of saved objects that you want to import into Kibana.\nYou must include `type` or `objects` in the request body.\n\nExported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.\n\nNOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.\n",
"tags": [
"saved objects"
],
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"excludeExportDetails": {
"description": "Do not add export details entry at the end of the stream.",
"type": "boolean",
"default": false
},
"includeReferencesDeep": {
"description": "Includes all of the referenced objects in the exported objects.",
"type": "boolean"
},
"objects": {
"description": "A list of objects to export.",
"type": "array",
"items": {
"type": "object"
}
},
"type": {
"description": "The saved object types to include in the export. Use `*` to export all the types.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
},
"examples": {
"exportSavedObjectsRequest": {
"$ref": "#/components/examples/export_objects_request"
}
}
}
}
},
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/x-ndjson": {
"schema": {
"type": "object",
"additionalProperties": true
},
"examples": {
"exportSavedObjectsResponse": {
"$ref": "#/components/examples/export_objects_response"
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
}
}
},
"/api/saved_objects/_import": {
"post": {
"summary": "Import saved objects",
"operationId": "importSavedObjectsDefault",
"description": "Create sets of Kibana saved objects from a file created by the export API.\nSaved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.\n",
"tags": [
"saved objects"
],
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
},
{
"in": "query",
"name": "createNewCopies",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.\n"
},
{
"in": "query",
"name": "overwrite",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.\n"
},
{
"in": "query",
"name": "compatibilityMode",
"schema": {
"type": "boolean"
},
"required": false,
"description": "Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.\n"
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"file": {
"description": "A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.\n"
}
}
},
"examples": {
"importObjectsRequest": {
"$ref": "#/components/examples/import_objects_request"
}
}
}
}
},
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.\n"
},
"successCount": {
"type": "integer",
"description": "Indicates the number of successfully imported records."
},
"errors": {
"type": "array",
"items": {
"type": "object"
},
"description": "Indicates the import was unsuccessful and specifies the objects that failed to import.\n\nNOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.\n"
},
"successResults": {
"type": "array",
"items": {
"type": "object"
},
"description": "Indicates the objects that are successfully imported, with any metadata if applicable.\n\nNOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.\n"
}
}
},
"examples": {
"importObjectsResponse": {
"$ref": "#/components/examples/import_objects_response"
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
},
"x-codeSamples": [
{
"lang": "cURL",
"label": "Import with createNewCopies",
"source": "curl \\\n -X POST api/saved_objects/_import?createNewCopies=true\n -H \"kbn-xsrf: true\"\n --form file=@file.ndjson\n"
}
]
}
}
},
"components": {
"parameters": {
"kbn_xsrf": {
"schema": {
"type": "string"
},
"in": "header",
"name": "kbn-xsrf",
"description": "Cross-site request forgery protection",
"required": true
}
},
"examples": {
"export_objects_request": {
"summary": "Export a specific saved object.",
"value": {
"objects": [
{
"type": "map",
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2"
}
],
"includeReferencesDeep": false,
"excludeExportDetails": true
}
},
"export_objects_response": {
"summary": "The export objects API response contains a JSON record for each exported object.",
"value": {
"attributes": {
"description": "",
"layerListJSON": "[{\"id\":\"0hmz5\",\"alpha\":1,\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"visible\":true,\"style\":{},\"type\":\"EMS_VECTOR_TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"edh66\",\"label\":\"Total Requests by Destination\",\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.5,\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"world_countries\",\"tooltipProperties\":[\"name\",\"iso2\"]},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e\",\"origin\":\"join\"},\"color\":\"Greys\",\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\",\"joins\":[{\"leftField\":\"iso2\",\"right\":{\"type\":\"ES_TERM_SOURCE\",\"id\":\"673ff994-fc75-4c67-909b-69fcb0e1060e\",\"indexPatternTitle\":\"kibana_sample_data_logs\",\"term\":\"geo.dest\",\"indexPatternRefName\":\"layer_1_join_0_index_pattern\",\"metrics\":[{\"type\":\"count\",\"label\":\"web logs count\"}],\"applyGlobalQuery\":true}}]},{\"id\":\"gaxya\",\"label\":\"Actual Requests\",\"minZoom\":9,\"maxZoom\":24,\"alpha\":1,\"sourceDescriptor\":{\"id\":\"b7486535-171b-4d3b-bb2e-33c1a0a2854c\",\"type\":\"ES_SEARCH\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[\"clientip\",\"timestamp\",\"host\",\"request\",\"response\",\"machine.os\",\"agent\",\"bytes\"],\"indexPatternRefName\":\"layer_2_source_index_pattern\",\"applyGlobalQuery\":true,\"scalingType\":\"LIMIT\"},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#2200ff\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":2}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"bytes\",\"origin\":\"source\"},\"minSize\":1,\"maxSize\":23,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\"},{\"id\":\"tfi3f\",\"label\":\"Total Requests and Bytes\",\"minZoom\":0,\"maxZoom\":9,\"alpha\":1,\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"resolution\":\"COARSE\",\"id\":\"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b\",\"geoField\":\"geo.coordinates\",\"requestType\":\"point\",\"metrics\":[{\"type\":\"count\",\"label\":\"web logs count\"},{\"type\":\"sum\",\"field\":\"bytes\"}],\"indexPatternRefName\":\"layer_3_source_index_pattern\",\"applyGlobalQuery\":true},\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Blues\",\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#cccccc\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"sum_of_bytes\",\"origin\":\"source\"},\"minSize\":7,\"maxSize\":25,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"labelText\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"labelSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"minSize\":12,\"maxSize\":24,\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3}}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}}},\"type\":\"GEOJSON_VECTOR\"}]",
"mapStateJSON": "{\"zoom\":3.64,\"center\":{\"lon\":-88.92107,\"lat\":42.16337},\"timeFilters\":{\"from\":\"now-7d\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":0},\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"settings\":{\"autoFitToDataBounds\":false}}",
"title": "[Logs] Total Requests and Bytes",
"uiStateJSON": "{\"isDarkMode\":false}"
},
"coreMigrationVersion": "8.8.0",
"created_at": "2023-08-23T20:03:32.204Z",
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2",
"managed": false,
"references": [
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_1_join_0_index_pattern",
"type": "index-pattern"
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_2_source_index_pattern",
"type": "index-pattern"
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"name": "layer_3_source_index_pattern",
"type": "index-pattern"
}
],
"type": "map",
"typeMigrationVersion": "8.4.0",
"updated_at": "2023-08-23T20:03:32.204Z",
"version": "WzEzLDFd"
}
},
"import_objects_request": {
"value": {
"file": "file.ndjson"
}
},
"import_objects_response": {
"summary": "The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.",
"value": {
"successCount": 1,
"success": true,
"successResults": [
{
"type": "index-pattern",
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"meta": {
"title": "Kibana Sample Data Logs",
"icon": "indexPatternApp"
},
"managed": false,
"destinationId": "82d2760c-468f-49cf-83aa-b9a35b6a8943"
}
]
}
}
},
"schemas": {
"400_response": {
"title": "Bad request",
"type": "object",
"required": [
"error",
"message",
"statusCode"
],
"properties": {
"error": {
"type": "string",
"enum": [
"Bad Request"
]
},
"message": {
"type": "string"
},
"statusCode": {
"type": "integer",
"enum": [
400
]
}
}
}
}
}
}

View file

@ -1,262 +0,0 @@
openapi: 3.0.3
info:
title: Serverless saved objects
description: OpenAPI schema for serverless saved object endpoints
version: '0.1'
contact:
name: Kibana Core Team
license:
name: Elastic License 2.0
url: https://www.elastic.co/licensing/elastic-license
servers:
- url: https://{kibana_url}
variables:
kibana_url:
default: localhost:5601
tags:
- name: saved objects
x-displayName: Saved objects
description: |
Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.
To manage a specific type of saved object, use the corresponding APIs.
For example, use:
[Data views](../group/endpoint-data-views)
Warning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions.
paths:
/api/saved_objects/_export:
post:
summary: Export saved objects
operationId: exportSavedObjectsDefault
description: |
Retrieve sets of saved objects that you want to import into Kibana.
You must include `type` or `objects` in the request body.
Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.
tags:
- saved objects
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
excludeExportDetails:
description: Do not add export details entry at the end of the stream.
type: boolean
default: false
includeReferencesDeep:
description: Includes all of the referenced objects in the exported objects.
type: boolean
objects:
description: A list of objects to export.
type: array
items:
type: object
type:
description: The saved object types to include in the export. Use `*` to export all the types.
oneOf:
- type: string
- type: array
items:
type: string
examples:
exportSavedObjectsRequest:
$ref: '#/components/examples/export_objects_request'
responses:
'200':
description: Indicates a successful call.
content:
application/x-ndjson:
schema:
type: object
additionalProperties: true
examples:
exportSavedObjectsResponse:
$ref: '#/components/examples/export_objects_response'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
/api/saved_objects/_import:
post:
summary: Import saved objects
operationId: importSavedObjectsDefault
description: |
Create sets of Kibana saved objects from a file created by the export API.
Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
tags:
- saved objects
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
- in: query
name: createNewCopies
schema:
type: boolean
required: false
description: |
Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.
- in: query
name: overwrite
schema:
type: boolean
required: false
description: |
Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.
- in: query
name: compatibilityMode
schema:
type: boolean
required: false
description: |
Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
description: |
A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.
examples:
importObjectsRequest:
$ref: '#/components/examples/import_objects_request'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
description: |
Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
successCount:
type: integer
description: Indicates the number of successfully imported records.
errors:
type: array
items:
type: object
description: |
Indicates the import was unsuccessful and specifies the objects that failed to import.
NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.
successResults:
type: array
items:
type: object
description: |
Indicates the objects that are successfully imported, with any metadata if applicable.
NOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.
examples:
importObjectsResponse:
$ref: '#/components/examples/import_objects_response'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
x-codeSamples:
- lang: cURL
label: Import with createNewCopies
source: |
curl \
-X POST api/saved_objects/_import?createNewCopies=true
-H "kbn-xsrf: true"
--form file=@file.ndjson
components:
parameters:
kbn_xsrf:
schema:
type: string
in: header
name: kbn-xsrf
description: Cross-site request forgery protection
required: true
examples:
export_objects_request:
summary: Export a specific saved object.
value:
objects:
- type: map
id: de71f4f0-1902-11e9-919b-ffe5949a18d2
includeReferencesDeep: false
excludeExportDetails: true
export_objects_response:
summary: The export objects API response contains a JSON record for each exported object.
value:
attributes:
description: ''
layerListJSON: '[{"id":"0hmz5","alpha":1,"sourceDescriptor":{"type":"EMS_TMS","isAutoSelect":true,"lightModeDefault":"road_map_desaturated"},"visible":true,"style":{},"type":"EMS_VECTOR_TILE","minZoom":0,"maxZoom":24},{"id":"edh66","label":"Total Requests by Destination","minZoom":0,"maxZoom":24,"alpha":0.5,"sourceDescriptor":{"type":"EMS_FILE","id":"world_countries","tooltipProperties":["name","iso2"]},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"__kbnjoin__count__673ff994-fc75-4c67-909b-69fcb0e1060e","origin":"join"},"color":"Greys","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"STATIC","options":{"size":10}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR","joins":[{"leftField":"iso2","right":{"type":"ES_TERM_SOURCE","id":"673ff994-fc75-4c67-909b-69fcb0e1060e","indexPatternTitle":"kibana_sample_data_logs","term":"geo.dest","indexPatternRefName":"layer_1_join_0_index_pattern","metrics":[{"type":"count","label":"web logs count"}],"applyGlobalQuery":true}}]},{"id":"gaxya","label":"Actual Requests","minZoom":9,"maxZoom":24,"alpha":1,"sourceDescriptor":{"id":"b7486535-171b-4d3b-bb2e-33c1a0a2854c","type":"ES_SEARCH","geoField":"geo.coordinates","limit":2048,"filterByMapBounds":true,"tooltipProperties":["clientip","timestamp","host","request","response","machine.os","agent","bytes"],"indexPatternRefName":"layer_2_source_index_pattern","applyGlobalQuery":true,"scalingType":"LIMIT"},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"STATIC","options":{"color":"#2200ff"}},"lineColor":{"type":"STATIC","options":{"color":"#FFFFFF"}},"lineWidth":{"type":"STATIC","options":{"size":2}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"bytes","origin":"source"},"minSize":1,"maxSize":23,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"},{"id":"tfi3f","label":"Total Requests and Bytes","minZoom":0,"maxZoom":9,"alpha":1,"sourceDescriptor":{"type":"ES_GEO_GRID","resolution":"COARSE","id":"8aaa65b5-a4e9-448b-9560-c98cb1c5ac5b","geoField":"geo.coordinates","requestType":"point","metrics":[{"type":"count","label":"web logs count"},{"type":"sum","field":"bytes"}],"indexPatternRefName":"layer_3_source_index_pattern","applyGlobalQuery":true},"visible":true,"style":{"type":"VECTOR","properties":{"fillColor":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"color":"Blues","fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"lineColor":{"type":"STATIC","options":{"color":"#cccccc"}},"lineWidth":{"type":"STATIC","options":{"size":1}},"iconSize":{"type":"DYNAMIC","options":{"field":{"name":"sum_of_bytes","origin":"source"},"minSize":7,"maxSize":25,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelText":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"labelSize":{"type":"DYNAMIC","options":{"field":{"name":"doc_count","origin":"source"},"minSize":12,"maxSize":24,"fieldMetaOptions":{"isEnabled":false,"sigma":3}}},"symbolizeAs":{"options":{"value":"circle"}},"icon":{"type":"STATIC","options":{"value":"marker"}}}},"type":"GEOJSON_VECTOR"}]'
mapStateJSON: '{"zoom":3.64,"center":{"lon":-88.92107,"lat":42.16337},"timeFilters":{"from":"now-7d","to":"now"},"refreshConfig":{"isPaused":true,"interval":0},"query":{"language":"kuery","query":""},"settings":{"autoFitToDataBounds":false}}'
title: '[Logs] Total Requests and Bytes'
uiStateJSON: '{"isDarkMode":false}'
coreMigrationVersion: 8.8.0
created_at: '2023-08-23T20:03:32.204Z'
id: de71f4f0-1902-11e9-919b-ffe5949a18d2
managed: false
references:
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_1_join_0_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_2_source_index_pattern
type: index-pattern
- id: 90943e30-9a47-11e8-b64d-95841ca0b247
name: layer_3_source_index_pattern
type: index-pattern
type: map
typeMigrationVersion: 8.4.0
updated_at: '2023-08-23T20:03:32.204Z'
version: WzEzLDFd
import_objects_request:
value:
file: file.ndjson
import_objects_response:
summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.
value:
successCount: 1
success: true
successResults:
- type: index-pattern
id: 90943e30-9a47-11e8-b64d-95841ca0b247
meta:
title: Kibana Sample Data Logs
icon: indexPatternApp
managed: false
destinationId: 82d2760c-468f-49cf-83aa-b9a35b6a8943
schemas:
400_response:
title: Bad request
type: object
required:
- error
- message
- statusCode
properties:
error:
type: string
enum:
- Bad Request
message:
type: string
statusCode:
type: integer
enum:
- 400

View file

@ -1,12 +0,0 @@
summary: Export a specific saved object.
value:
{
"objects": [
{
"type": "map",
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2"
}
],
"includeReferencesDeep": false,
"excludeExportDetails": true
}

View file

@ -1,16 +0,0 @@
summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.
value:
{
"successCount":1,
"success":true,
"successResults":[
{
"type":"index-pattern",
"id":"90943e30-9a47-11e8-b64d-95841ca0b247",
"meta":{
"title":"Kibana Sample Data Logs","icon":"indexPatternApp"},
"managed":false,
"destinationId":"82d2760c-468f-49cf-83aa-b9a35b6a8943"
}
]
}

View file

@ -1,25 +0,0 @@
type: object
properties:
success:
type: boolean
description: |
Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
successCount:
type: integer
description: Indicates the number of successfully imported records.
errors:
type: array
items:
type: object
description: |
Indicates the import was unsuccessful and specifies the objects that failed to import.
NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.
successResults:
type: array
items:
type: object
description: |
Indicates the objects that are successfully imported, with any metadata if applicable.
NOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.

View file

@ -1,21 +0,0 @@
type: object
properties:
excludeExportDetails:
description: Do not add export details entry at the end of the stream.
type: boolean
default: false
includeReferencesDeep:
description: Includes all of the referenced objects in the exported objects.
type: boolean
objects:
description: A list of objects to export.
type: array
items:
type: object
type:
description: The saved object types to include in the export. Use `*` to export all the types.
oneOf:
- type: string
- type: array
items:
type: string

View file

@ -1,5 +0,0 @@
type: object
properties:
file:
description: |
A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.

View file

@ -8,20 +8,6 @@ info:
license:
name: Elastic License 2.0
url: https://www.elastic.co/licensing/elastic-license
tags:
- name: saved objects
x-displayName: Saved objects
description: |
Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.
To manage a specific type of saved object, use the corresponding APIs.
For example, use:
* [Data views](../group/endpoint-data-views)
* [Spaces](https://www.elastic.co/guide/en/kibana/current/spaces-api.html)
* [Short URLs](https://www.elastic.co/guide/en/kibana/current/short-urls-api.html)
Warning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions.
servers:
- url: /
paths:
@ -38,12 +24,8 @@ paths:
$ref: 'paths/api@saved_objects@_bulk_resolve.yaml'
'/api/saved_objects/_bulk_update':
$ref: 'paths/api@saved_objects@_bulk_update.yaml'
'/api/saved_objects/_export':
$ref: 'paths/api@saved_objects@_export.yaml'
'/api/saved_objects/_find':
$ref: 'paths/api@saved_objects@_find.yaml'
'/api/saved_objects/_import':
$ref: 'paths/api@saved_objects@_import.yaml'
'/api/saved_objects/_resolve_import_errors':
$ref: 'paths/api@saved_objects@_resolve_import_errors.yaml'
'/api/saved_objects/{type}':
@ -52,16 +34,3 @@ paths:
$ref: 'paths/api@saved_objects@{type}@{id}.yaml'
'/api/saved_objects/resolve/{type}/{id}':
$ref: 'paths/api@saved_objects@resolve@{type}@{id}.yaml'
# components:
# securitySchemes:
# basicAuth:
# type: http
# scheme: basic
# apiKeyAuth:
# type: apiKey
# in: header
# name: Authorization
# description: 'e.g. Authorization: ApiKey base64AccessApiKey'
# security:
# - basicAuth: []
# - apiKeyAuth: []

View file

@ -1,44 +0,0 @@
openapi: 3.0.3
info:
title: Serverless saved objects
description: OpenAPI schema for serverless saved object endpoints
version: '0.1'
contact:
name: Kibana Core Team
license:
name: Elastic License 2.0
url: https://www.elastic.co/licensing/elastic-license
tags:
- name: saved objects
x-displayName: Saved objects
description: |
Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.
To manage a specific type of saved object, use the corresponding APIs.
For example, use:
[Data views](../group/endpoint-data-views)
Warning: Do not write documents directly to the `.kibana` index. When you write directly to the `.kibana` index, the data becomes corrupted and permanently breaks future Kibana versions.
servers:
- url: 'https://{kibana_url}'
variables:
kibana_url:
default: localhost:5601
paths:
'/api/saved_objects/_export':
$ref: 'paths/api@saved_objects@_export.yaml'
'/api/saved_objects/_import':
$ref: 'paths/api@saved_objects@_import.yaml'
# components:
# securitySchemes:
# apiKeyAuth:
# type: apiKey
# in: header
# name: Authorization
# description: >
# Serverless APIs support only key-based authentication.
# You must create an API key and use the encoded value in the request header.
# For example: 'Authorization: ApiKey base64AccessApiKey'.
# security:
# - apiKeyAuth: []

View file

@ -1,60 +0,0 @@
post:
summary: Export saved objects
operationId: exportSavedObjectsDefault
description: |
Retrieve sets of saved objects that you want to import into Kibana.
You must include `type` or `objects` in the request body.
Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.
tags:
- saved objects
parameters:
- $ref: '../components/headers/kbn_xsrf.yaml'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
excludeExportDetails:
description: Do not add export details entry at the end of the stream.
type: boolean
default: false
includeReferencesDeep:
description: Includes all of the referenced objects in the exported objects.
type: boolean
objects:
description: A list of objects to export.
type: array
items:
type: object
type:
description: The saved object types to include in the export. Use `*` to export all the types.
oneOf:
- type: string
- type: array
items:
type: string
examples:
exportSavedObjectsRequest:
$ref: '../components/examples/export_objects_request.yaml'
responses:
'200':
description: Indicates a successful call.
content:
application/x-ndjson:
schema:
type: object
additionalProperties: true
examples:
exportSavedObjectsResponse:
$ref: '../components/examples/export_objects_response.yaml'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '../components/schemas/400_response.yaml'

View file

@ -1,92 +0,0 @@
post:
summary: Import saved objects
operationId: importSavedObjectsDefault
description: |
Create sets of Kibana saved objects from a file created by the export API.
Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
tags:
- saved objects
parameters:
- $ref: '../components/headers/kbn_xsrf.yaml'
- in: query
name: createNewCopies
schema:
type: boolean
required: false
description: |
Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.
- in: query
name: overwrite
schema:
type: boolean
required: false
description: |
Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.
- in: query
name: compatibilityMode
schema:
type: boolean
required: false
description: |
Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
description: |
A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.
examples:
importObjectsRequest:
$ref: '../components/examples/import_objects_request.yaml'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
description: |
Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
successCount:
type: integer
description: Indicates the number of successfully imported records.
errors:
type: array
items:
type: object
description: |
Indicates the import was unsuccessful and specifies the objects that failed to import.
NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.
successResults:
type: array
items:
type: object
description: |
Indicates the objects that are successfully imported, with any metadata if applicable.
NOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.
examples:
importObjectsResponse:
$ref: '../components/examples/import_objects_response.yaml'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '../components/schemas/400_response.yaml'
x-codeSamples:
- lang: cURL
label: Import with createNewCopies
source: |
curl \
-X POST api/saved_objects/_import?createNewCopies=true
-H "kbn-xsrf: true"
--form file=@file.ndjson

File diff suppressed because one or more lines are too long

View file

@ -7,6 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import path from 'node:path';
import { schema } from '@kbn/config-schema';
import stringify from 'json-stable-stringify';
import { createPromiseFromStreams, createMapStream, createConcatStream } from '@kbn/utils';
@ -20,6 +21,7 @@ import type { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-inte
import { SavedObjectsExportError } from '@kbn/core-saved-objects-import-export-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { InternalSavedObjectRouter } from '../internal_types';
import { badResponseSchema } from './shared_schemas';
import { validateTypes, validateObjects, catchAndReturnBoomErrors } from './utils';
interface RouteDependencies {
@ -148,8 +150,12 @@ export const registerExportRoute = (
summary: `Export saved objects`,
tags: ['oas-tag:saved objects'],
access: 'public',
description:
'Retrieve sets of saved objects that you want to import into Kibana. You must include `type` or `objects` in the request body. \nExported saved objects are not backwards compatible and cannot be imported into an older version of Kibana. \nNOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.',
description: `Retrieve sets of saved objects that you want to import into Kibana. You must include \`type\` or \`objects\` in the request body.
Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.
NOTE: The \`savedObjects.maxImportExportSize\` configuration setting limits the number of saved objects which may be exported.`,
oasOperationObject: () => path.resolve(__dirname, './export.examples.yaml'),
},
security: {
authz: {
@ -158,24 +164,62 @@ export const registerExportRoute = (
},
},
validate: {
body: schema.object({
type: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])),
hasReference: schema.maybe(
schema.oneOf([referenceSchema, schema.arrayOf(referenceSchema)])
),
objects: schema.maybe(
schema.arrayOf(
schema.object({
type: schema.string(),
id: schema.string(),
}),
{ maxSize: maxImportExportSize }
)
),
search: schema.maybe(schema.string()),
includeReferencesDeep: schema.boolean({ defaultValue: false }),
excludeExportDetails: schema.boolean({ defaultValue: false }),
}),
request: {
body: schema.object({
hasReference: schema.maybe(
schema.oneOf([referenceSchema, schema.arrayOf(referenceSchema)])
),
type: schema.maybe(
schema.oneOf([schema.string(), schema.arrayOf(schema.string())], {
meta: {
description:
'The saved object types to include in the export. Use `*` to export all the types.',
},
})
),
objects: schema.maybe(
schema.arrayOf(
schema.object({
type: schema.string(),
id: schema.string(),
}),
{
maxSize: maxImportExportSize,
meta: {
description:
'A list of objects to export. NOTE: this optiona cannot be combined with `types` option',
},
}
)
),
search: schema.maybe(
schema.string({
meta: {
description:
'Search for documents to export using the Elasticsearch Simple Query String syntax.',
},
})
),
includeReferencesDeep: schema.boolean({
defaultValue: false,
meta: {
description: 'Includes all of the referenced objects in the exported objects.',
},
}),
excludeExportDetails: schema.boolean({
defaultValue: false,
meta: { description: 'Do not add export details entry at the end of the stream.' },
}),
}),
},
response: {
200: {
bodyContentType: 'application/x-ndjson',
description: 'Indicates a successfull call.',
body: okResponseSchema,
},
400: badResponseSchema(),
},
},
},
catchAndReturnBoomErrors(async (context, request, response) => {
@ -246,3 +290,5 @@ export const registerExportRoute = (
})
);
};
const okResponseSchema = () => schema.object({}, { unknowns: 'allow' });

View file

@ -0,0 +1,37 @@
requestBody:
content:
multipart/form-data:
examples:
importObjectsRequest:
value:
file: file.ndjson
responses:
'200':
content:
application/json:
examples:
importObjectsResponse:
summary: The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.
value:
{
"successCount":1,
"success":true,
"successResults":[
{
"type":"index-pattern",
"id":"90943e30-9a47-11e8-b64d-95841ca0b247",
"meta":{
"title":"Kibana Sample Data Logs","icon":"indexPatternApp"},
"managed":false,
"destinationId":"82d2760c-468f-49cf-83aa-b9a35b6a8943"
}
]
}
x-codeSamples:
- lang: cURL
label: Import with createNewCopies
source: |
curl \
-X POST api/saved_objects/_import?createNewCopies=true
-H "kbn-xsrf: true"
--form file=@file.ndjson

View file

@ -8,12 +8,14 @@
*/
import { Readable } from 'stream';
import path from 'node:path';
import { extname } from 'path';
import { schema } from '@kbn/config-schema';
import type { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import { SavedObjectsImportError } from '@kbn/core-saved-objects-import-export-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { InternalSavedObjectRouter } from '../internal_types';
import { badResponseSchema } from './shared_schemas';
import { catchAndReturnBoomErrors, createSavedObjectsStreamFromNdJson } from './utils';
interface RouteDependencies {
@ -47,6 +49,7 @@ export const registerImportRoute = (
output: 'stream',
accepts: 'multipart/form-data',
},
oasOperationObject: () => path.resolve(__dirname, './import.examples.yaml'),
},
security: {
authz: {
@ -55,27 +58,60 @@ export const registerImportRoute = (
},
},
validate: {
query: schema.object(
{
overwrite: schema.boolean({ defaultValue: false }),
createNewCopies: schema.boolean({ defaultValue: false }),
compatibilityMode: schema.boolean({ defaultValue: false }),
},
{
validate: (object) => {
if (object.overwrite && object.createNewCopies) {
return 'cannot use [overwrite] with [createNewCopies]';
}
if (object.createNewCopies && object.compatibilityMode) {
return 'cannot use [createNewCopies] with [compatibilityMode]';
}
request: {
query: schema.object(
{
overwrite: schema.boolean({
defaultValue: false,
meta: {
description:
'Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.',
},
}),
createNewCopies: schema.boolean({
defaultValue: false,
meta: {
description:
'Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.',
},
}),
compatibilityMode: schema.boolean({
defaultValue: false,
meta: {
description:
'Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.',
},
}),
},
}
),
body: schema.object({
file: schema.stream(),
}),
{
validate: (object) => {
if (object.overwrite && object.createNewCopies) {
return 'cannot use [overwrite] with [createNewCopies]';
}
if (object.createNewCopies && object.compatibilityMode) {
return 'cannot use [createNewCopies] with [compatibilityMode]';
}
},
}
),
body: schema.object({
file: schema.stream({
meta: {
description:
'A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.',
},
}),
}),
},
response: {
200: {
description: 'Indicates a successful call.',
bodyContentType: 'application/json',
body: okResponseSchema,
},
400: badResponseSchema(),
},
},
},
catchAndReturnBoomErrors(async (context, request, response) => {
@ -139,3 +175,30 @@ export const registerImportRoute = (
})
);
};
const okResponseSchema = () =>
schema.object({
success: schema.boolean({
meta: {
description:
'Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.',
},
}),
successCount: schema.number({
meta: { description: 'Indicates the number of successfully imported records.' },
}),
errors: schema.arrayOf(schema.object({}, { unknowns: 'allow' }), {
meta: {
description: `Indicates the import was unsuccessful and specifies the objects that failed to import.
NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a \`missing_references\` error and conflict error.`,
},
}),
successResults: schema.arrayOf(schema.object({}, { unknowns: 'allow' }), {
meta: {
description: `Indicates the objects that are successfully imported, with any metadata if applicable.
NOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the \`successResults\` array includes a \`destinationId\` attribute.`,
},
}),
});

View file

@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import { schema } from '@kbn/config-schema';
export const badResponseSchema = () => ({
description: 'Bad request.',
bodyContentType: 'application/json',
body: () =>
schema.object(
{
error: schema.string(),
message: schema.string(),
statusCode: schema.literal(400),
},
{
meta: {
description: 'Indicates an unsuccessful response.',
},
}
),
});