Our Blog

import-export

An Easy Way to Export / Import Dashboards, Searches and Visualizations from Kibana

Introduction

Manually recreating Kibana dashboards, searches, and visualizations during upgrades, production deployment or recovery is a time-consuming affair. The easiest way to recreate the prebuilt Kibana dashboard and other objects is by exporting and importing dashboards, searches, and visualizations. This can be achieved by using,

  • Kibana API (available since Kibana 7.x) 
  • Kibana UI

If are you looking to export and import the Kibana dashboards and its dependencies automatically, we recommend the Kibana API’s. Also, you can export and import dashboard from Kibana UI.

Note: User should add the dependencies of the dashboards like visualization, index pattern individually while exporting or importing from Kibana UI.

Export Objects From Kibana API

The export API enables you to retrieve a set of saved objects that can later be imported into Kibana.

Request

POST /api/saved_objects/_export

Request Body

At least type or objects must be passed in within the request body.

type (optional)

(array/string) The saved object type(s) that the export should be limited to.

The following example exports all index pattern saved objects.

POST api/saved_objects/_export { “type”: “index-pattern” }

Example Curl:

curl -X POST “http://localhost:5601/api/saved_objects/_export” -H ‘kbn-xsrf: true’ -H ‘Content-Type: application/json’ -d’ { “type”: “index-pattern” } ‘

objects (optional)

(array) A list of objects to export

The following example exports specific saved objects.

POST api/saved_objects/_export

{

  “objects”: [

    {

      “type”: “dashboard”,

      “id”: “be3733a0-9efe-11e7-acb3-3dab96693fab”

    }  ]

}

Example Curl:

curl -X POST “http://localhost:5601/api/saved_objects/_export” -H ‘kbn-xsrf: true’ -H ‘Content-Type: application/json’ -d’ { “objects”: [ { “type”: “dashboard”, 

“id”: “be3733a0-9efe-11e7-acb3-3dab96693fab” } ] } ‘

Response Body

The response body will have a format of newline delimited JSON and the successful call returns a response code of 200 along with the exported objects as the response body.

Import Objects From Kibana API

The import API enables you to create a set of Kibana saved objects from a file created by the export API.

Request

POST /api/saved_objects/_import

Request Body

The request body must be of type multipart/form-data.

File

A file exported using the export API.

Example

The following example imports an index pattern and dashboard.

curl -X POST “localhost:5601/api/saved_objects/_import” -H “kbn-xsrf: true” –form [email protected]

The file.ndjson file would contain the following.

{“type”:”index-pattern”,”id”:”my-pattern”,”attributes”:{“title”:”my-pattern-*”}}

{“type”:”dashboard”,”id”:”my-dashboard”,”attributes”:{“title”:”Look at my dashboard”}

Response Body

A successful call returns a response code of 200 and a response body containing a JSON structure similar to the following example:

{

  “success”: true,

  “successCount”: 2

}

Export Objects From Kibana UI:

You can now export your objects from Kibana UI under Management > Saved Objects > Export. Select the checkboxes of the objects you want to export, and click Export. Or to export objects by type:

  • Click Export objects.
  • Select the object types you want to export.
  • Click Export All.
kibana export

Import Objects From Kibana UI:

 You can import your JSON file from Kibana UI under Management > Saved Objects > Import. Follow the below steps to import your 

  • Click Import.
  • Navigate to the JSON file that represents the objects to import.
  • Indicate whether to overwrite objects already in Kibana.
  • Click Import.
kibana

Summary:

Exporting and importing the saved objects from the Kibana is an effective and easiest way to recreate dashboards and other objects in new environments or during migrations.

If you are looking to automate and make the process simpler,  we recommend using the Kibana APIs or else you can use the Kibana UI for granular export and import.

If you are looking for a Kibana reporting solution, be sure to test drive Skedler.

Start your 15-day free trial with instant download

Automate what’s slowing you down. Focus on what fires you up.

Copyright © 2023 Guidanz Inc
Translate »