一尘不染

如何使用RESTful API在Kibana中导入/导出仪表板

elasticsearch

我想使用HTTP方法将新的仪表板发布到我的本地Kibana实例,但是我找不到太多有关使用API​​进行此操作的文档。

在Kibana上有一个请求请求,提到它正在添加此功能,但是关于如何使用它的文档有限:https
:
//github.com/elastic/kibana/pull/10858

我要发布的仪表板示例:

{ "_id": "12345678-1234-1234-1234-1234567890op", "_type": "dashboard", "_source": { "title": "my-app", "hits": 0, "description": "", "panelsJSON": "", "optionsJSON": "{\"darkTheme\":false}", "uiStateJSON": "", "version": 1, "timeRestore": true, "timeTo": "now/d", "timeFrom": "now/d", "refreshInterval": { "display": "1 minute", "pause": false, "section": 2, "value": 60000 }, "kibanaSavedObjectMeta": { "searchSourceJSON": "" } } }


阅读 903

收藏
2020-06-22

共1个答案

一尘不染

出口:

curl "localhost:5601/api/kibana/dashboards/export?dashboard=980381a0-a266-11e7-8f86-edd4a877426e" > export.json

{
  "version": "7.0.0-alpha1",
  "objects": [
    {
      "id": "12345678-1234-1234-1234-1234567890op",
      "type": "dashboard",
      "properties": {
        "title": "my-app",
        "hits": 0,
        "description": "",
        "panelsJSON": "",
        "optionsJSON": "{\"darkTheme\":false}",
        "uiStateJSON": "",
        "version": 1,
        "timeRestore": true,
        "timeTo": "now/d",
        "timeFrom": "now/d",
        "refreshInterval": {
          "display": "1 minute",
          "pause": false,
          "section": 2,
          "value": 60000
        }
      }
    }
  ]
}

进口:

从仪表板导出API发布响应。

curl -X POST -H "Content-Type: application/json" -H "kbn-xsrf: true" -d @export.json http://localhost:5601/api/kibana/dashboards/import
2020-06-22