title: How to convert types when reading data from Elasticsearch using elasticsearch-spark in SPARK
body: <p>When i try to read data from elasticsearch using the <code>esRDD("index")</code> function in elasticsearch-spark, i get the results in type <code>org.apache.spark.rdd.RDD[(String, scala.collection.Map[String,AnyRef])]</code>. And when i check the values, they are all type <code>AnyRef</code>. However, i saw in on <a href="https://www.elastic.co/guide/en/elasticsearch/hadoop/current/spark.html" rel="nofollow noreferrer">ES site</a>, it says :</p>
  
  <blockquote>
    <p>elasticsearch-hadoop automatically converts Spark built-in types to Elasticsearch types (and back)</p>
  </blockquote>
  
  <p>My dependencies are:  </p>
  
  <pre><code>scalaVersion := "2.11.8"
  libraryDependencies += "org.apache.spark" %% "spark-core" % "2.1.0"  
  libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.1.0"  
  libraryDependencies += "org.apache.spark" %% "spark-mllib" % "2.1.0"  
  libraryDependencies += "org.elasticsearch" % "elasticsearch-spark-20_2.11" % "5.4.0"
  </code></pre>
  
  <p>Do I miss something? And how can i convert the types in a convenient way?</p>