REST API for setting default landing page and index pattern for a space

Is there a REST API for setting the default landing page and index pattern for a space ? I want to programatically create a space and set these attributes.


Hey, both of these things are configured via "advanced settings". These are stored in a saved object as well (type config). Because of this you can use the Saved objects APIs | Kibana Guide [master] | Elastic to write the advanced settings object per space with the defaultRoute and defaultIndex settings.

defaultIndex has to be a saved object id of the index pattern saved object, not the pattern itself (you have to create that first, but it's also possible via saved objects API)

Thanks a lot. Will try it out.

Just want to confirm the sequence of steps:

  1. Create a config object with defaultRoute value set to the name of the space and defaultIndex set to the id of the default index pattern for the space
  2. Use update saved objects API to update the space with config object id

yeah, exactly. Step 1 would happen in your script somehow, then you can use any http client to send it to Kibana. For the exact shape of the config object, the easiest approach is to set those things once via ui, then export it and rebuild the same structure in your script.

Thanks. How do I export the config object ? By default, I don't see any config object under saved objects in Kibana UI even after modifying a namespace with default Index and default route

Go to Advanced Settings in Kibana UI. Change default route from /home/app or whatever it is. Save it. Change it back. Save it. Now that field is in the saved object.

To programmatically update. Might need to add space and change version.

PUT - http://localhost:5601/api/saved_objects/config/7.11.0

kbn-xsrf = true


  "attributes": {
    "defaultRoute": "/app/home"

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.