Check out example codes for "read from elasticsearch in spark". It will help you in understanding the concepts better.

Code Example 1

...
import org.elasticsearch.spark._

...
val conf = ...
val sc = new SparkContext(conf)

sc.esRDD("radio/artists", "?q=me*")

Code Example 2

import org.apache.spark.SparkContext    
import org.apache.spark.SparkContext._

import org.elasticsearch.spark._        

...

val conf = ...
val sc = new SparkContext(conf)         

val RDD = sc.esRDD("radio/artists")

Learn ReactJs, React Native from akashmittal.com