Skip to content

Instantly share code, notes, and snippets.

@RooseveltAdvisors
Created September 29, 2016 01:56
Show Gist options
  • Save RooseveltAdvisors/0c737908eea42530e0501cbf77655997 to your computer and use it in GitHub Desktop.
Save RooseveltAdvisors/0c737908eea42530e0501cbf77655997 to your computer and use it in GitHub Desktop.
import org.elasticsearch.spark._
import org.apache.spark.sql._
//val sqlContext = new SQLContext(sc)
val options = Map("pushdown" -> "true", "es.nodes" -> "host_ip_here", "es.port" -> "9200",
"es.nodes.wan.only" -> "true")
sqlContext.read.format("es").options(options).load("index_name").write.mode(SaveMode.Overwrite).json("path_to_output")
sc.esRDD("index_name",options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment