If your Elasticsearch requires authentication, you need to provide credentials to be able to load index templates. I guess you are using X-Pack, where basic authentication is default.
May I ask you what is your question regarding the behavior you described above?
Since this a discussion forum, I shared this experience for the people who might get into this issue to shorten the overhead for them because I spent 30 mins searching for the answer.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.