anchor.diff:  
   [quote, Spark website]
   ____
  -http://spark.apache.org/sql/[Spark SQL] allows relational queries expressed in SQL, HiveQL, or Scala to be executed using Spark. At the core of this component is a new type of RDD, SchemaRDD. A SchemaRDD is similar to a table in a traditional relational database. [...] Spark SQL is currently an alpha component. 
  +http://spark.apache.org/sql/[Spark SQL] allows relational queries expressed in SQL, HiveQL, or Scala to be executed using Spark. At the core of this component is a new type of +RDD+, SchemaRDD. A SchemaRDD is similar to a table in a traditional relational database. [...] Spark SQL is currently an alpha component. 
   ____
   On top of the core Spark support, {eh} also provides integration with Spark SQL. In other words, {es} becomes a _native_ source for Spark SQL so that data can be indexed and queried from Spark SQL _transparently_.
   
  
positive.code: <1> Spark Scala imports
  <2> {eh} Scala imports
  <3> start Spark through its Scala API
  <4> `makeRDD` creates an ad-hoc `RDD` based on the collection specified; any other RDD (in Java or Scala) can be passed in
  <5> index the content (namely the two _documents_ (numbers and airports)) in {es} under `spark/docs`
  
  NOTE: Scala users might be tempted to use +Seq+ and the +->+ notation for declaring _root_ objects (that is the JSON document) instead of using a +Map+. While similar, the first notation results in slightly different types that cannot be matched to a JSON document: +Seq+ is an order sequence (in other words a list) while +<-+ creates a +Tuple+ which is more or less an ordered, fixed number of elements. As such, a list of lists cannot be used as a document since it cannot be mapped to a JSON object; however it can be used freely within one. Hence why in the example above ++Map(k->v)++ was used instead of ++Seq(k->v)++
  
  As an alternative to the _implicit_ import above, one can {eh} Spark support in Scala through +EsSpark+ in +org.elasticsearch.spark.rdd+ package which acts as an utility class allowing explicit method invocations; thus the example 
  above can be rewritten as:
  
  [source,scala]
  ----
  import org.apache.spark.SparkContext             
  import org.elasticsearch.spark.rdd.EsSpark       <1>
  
  ...
  val rdd = sc.makeRDD(Seq(numbers, airports))
  EsSpark.saveToEs(rdd, "spark/docs")              <2> 
  ----
  
  <1> +EsSpark+ import
  <2> Index the +RDD+ explicitly through +EsSpark+
  
  For cases where the id (or other metadata fields like +ttl+ or +timestamp+) of the document needs to be specified, one can do so by setting the appropriate <<cfg-mapping, mapping>> namely +es.mapping.id+. Following the previous example, to indicate to {es} to use the field +id+ as the document id, update the +RDD+ configuration (it is also possible to set the property on the +SparkConf+ though due to its global effect it is discouraged):
  
  
negative.code: [[spark-write]]
  ==== Writing data to {es}
  
  With {eh}, any +RDD+ can be saved to {es} as long as its content can be translated into documents. In practice this means the +RDD+ type needs to be a +Map+ (whether a Scala or a Java one), a http://docs.oracle.com/javase/tutorial/javabeans/[+JavaBean+] or a Scala http://docs.scala-lang.org/tutorials/tour/case-classes.html[case class]. When that is not the case, one can easily _transform_ the data
  in Spark or plug-in their own customer <<configuration-serialization,+ValueWriter+>>.
  
  .Scala
  