How to create a default index pattern via kibana api

Using the experimental Kibana 7.8 API, how can i create a DEFAULT index pattern.

I am calling the api as such:

http://kibana:5601/s/<some space>/api/saved_objects/index-pattern/dummy_index_pattern
{
  "attributes": {
     "title": "logstash-*",
    "timeFieldName": "@timestamp"
  }
}

However, only an index pattern is made, but default is not set. Any information would be greatly appreciated.

The default index pattern is part of the config saved object. To programmatically create a new index pattern and make it default, you have to create the index pattern saved object first, then write a config object in which the default index pattern is set to the id from the response of the first request.

The key in the config object holding the id of the index pattern is called defaultIndex

i did the following:

/s/<some space>/api/saved_objects/config/dummy_index_pattern_config
{
  "attributes": {
    "defaultIndex": "dummy_index_pattern"
  } 
}

however, the result remains the same. the index is not set as default.

Under Saved Objects in Kibana i see two advance settings now

[Advanced Settings [dummy_index_pattern_config]]
[Advanced Settings [7.8.0]]

may be i need to directly update 7.8.0 rather than create a new CONFIG?

Solution: use 7.8.0 config do not use custom config.

/s/<some space>/api/saved_objects/config/7.8.0