How to create a default index pattern via python api

if you re-read what i had written in the post you would see that you need to call

http://kibana:5601/s/<some space>/api/saved_objects/index-pattern/dummy_index_pattern
http://kibana:5601/s/<some space>/api/saved_objects/index-pattern/7.8.0

you do not need to call an elasticsearch endpoint.

regardless of the language you use to write an API call the above URL is what you should be using.
<some space> is whatever space you have created. assuming you have created a space. if not do so or remove /s/<some space> from the URL. it all depends on what you are trying to do. In my case, i made a default index for specific spaces. As well, i am using 7.8.0 i do not know what version of kibana you have.