Set default index automatically in new spaces

Hey @Steven_Ensslen,

To set the default index pattern for a new space, you can prefix the API call with the space identifier. For example, if you are setting this for the "Marketing" space with a Space Identifier of marketing, then your API call would look something like:

POST /s/marketing/api/kibana/settings/defaultIndex

{
   "value": "indexPatternGUID"
}

If you were to inspect your .kibana index, this would set the default index pattern for the marketing space to the index pattern with the document id marketing:index-pattern:indexPatternGUID.

A couple of notes:

  • This will not create the index pattern; it only tells Kibana which index pattern should be the default for that particular space.
  • The API endpoint to set the default index pattern is not a publicly documented API, so it can potentially change unexpectedly between versions.
  • We recognize the docs for calling APIs within a particular space are lacking. We have a few open issues to improve the documentation, including https://github.com/elastic/kibana/issues/29646
1 Like