How to import index-pattern in kibana 6 using API?

After more investigation with the links you provided,
I've successfully installed a index-pattern in a indirect way.
I've done it by installing a dashboard. It seems that it also installs the index-patterns that depends on it.

However, I don't see how to set an index-pattern as the defaultIndex using an API.

I see that the defaultIndex is stored in the .kibana config but I don't know how to set it:

curl -XGET http://localhost:9200/.kibana/doc/_search?q=type:config

{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":1,"max_score":3.205453,"hits":[{"_index":".kibana","_type":"doc","_id":"config:6.0.0","_score":3.205453,"_source":{"type":"config","config":{"buildNum":16070,"defaultIndex":"291176c0-cfda-11e7-a5ef-9f5ab64be49e"}}}]}}

Any help on this will be very much appreciated. Thanks.