Hi everyone,
I have a dashboard and I'd like to import the markdown visualisation (containing only text) to the chosen dashboard via API.
First I export the visualisation data, analyse it and after I'd like to import the newly created text panel into the dashboard. All of it is done programatically, so the only option of import for me is the API.
Any suggestion on how can I achieve this?
P.S. I know about the import/export saved objects API but from documentation it seems for me that it's possible to import only dashboards, index-patterns etc. but not the visualisations
Hi @Nikita_Vasyliev ,
First of all you can import Visualisation only saved object via SO import API, at least with Kibana 8.x I believe it is doable.
The quickest way is to try it out via UI and then you can automate it with API call.
Just make sure your .ndjson
has a compatible structure:
{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"}}
But it will be a saved object in Kibana without link to the specific dashboard.
If you want to to update the existing dashboard with this new visualisation that you imported, you can re-import saved object of this dashboard and its child visualisations all together in the same .ndjson
file. It is important for your dashboard to have references to each visualisation it contains.
Regards, Dima
Thanks for the reply!
So, just to make sure I understood everything correctly. The suggested algorithm is the following:
- Import visualisation via so api
- Export whole dashboard via so api
- Add visualisation object to the exported dashboard object
- Import updated dashboard as the newly created saved object, basically creating another dashboard
Right?
Your .ndjson
can have multiple saved objects, the most crucial action is to link you new visualisation to the dashboard saved object, if you store dashboard somewhere as saved object in a file -> just go and update it directly.
I see it this way:
- Create a custom .ndjson by merging Vis SO into existing SOs of dashboard and all its visualisations. Never tried it myself, but it should be possible since dashboard references the ids of vis it contains, right?
- Import generated file into Kibana.
FIrst you can try step 1 manually or even via KIbana UI to understand what actually you need to change.
Regards, Dima