title: spark elastic search throwing 403 forbidden error
body: <p>When I tried to connect the elasticsearch from spark using basic authentication to create a new index got below error.</p>
  
  <p>Error from elastic search is not giving full error information to debug more</p>
  
  <pre><code> org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest: [HEAD] on [devl_test_index] failed; server[https://&lt;elasticServerHost&gt;:9200] returned [403|Forbidden:]
              at org.elasticsearch.hadoop.rest.RestClient.checkResponse(RestClient.java:477)
              at org.elasticsearch.hadoop.rest.RestClient.executeNotFoundAllowed(RestClient.java:447)
              at org.elasticsearch.hadoop.rest.RestClient.exists(RestClient.java:539)
              at org.elasticsearch.hadoop.rest.RestClient.indexExists(RestClient.java:534)
              at org.elasticsearch.hadoop.rest.RestClient.touch(RestClient.java:545)
              at org.elasticsearch.hadoop.rest.RestRepository.touch(RestRepository.java:364)
              at org.elasticsearch.hadoop.rest.RestService.initSingleIndex(RestService.java:660)
              at org.elasticsearch.hadoop.rest.RestService.createWriter(RestService.java:636)
              at org.elasticsearch.spark.rdd.EsRDDWriter.write(EsRDDWriter.scala:65)
              at org.elasticsearch.spark.sql.EsSparkSQL$$anonfun$saveToEs$1.apply(EsSparkSQL.scala:101)
              at org.elasticsearch.spark.sql.EsSparkSQL$$anonfun$saveToEs$1.apply(EsSparkSQL.scala:101)
              at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
              at org.apache.spark.scheduler.Task.run(Task.scala:109)
              at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:345)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Code used to connect: </p>
  
  <pre><code>Sbt dependency: "org.elasticsearch" % "elasticsearch-hadoop" % "7.5.0"
  
  import org.elasticsearch.spark.sql._
  
   val spark = SparkSession.builder().appName("SparkJDBC")
      .enableHiveSupport()
      .config("spark.es.port","9200")
      .config("spark.es.nodes", "&lt;elasticServerHost&gt;")
      .config("spark.es.nodes.wan.only","true")
      .config("spark.es.net.ssl","true")
      .config("spark.es.net.http.auth.user","USERNAME")
      .config("spark.es.net.http.auth.pass","PASSWRD")
      .master("local[*]")
      .getOrCreate()
  
  val df = spark.sql("select * from employee")
  
  df.saveToEs("devl_test_index")
  </code></pre>