Created 07-19-2018 12:50 PM
I am trying to save a json file in Elasticsearch using spark scala, but the code not working.
here is the code:
import org.apache.spark import org.apache.spark.{SparkConf, SparkContext} import org.elasticsearch.spark._ import org.apache.spark.sql._ object JsontoES { def main(args: Array[String]): Unit = { val conf = new SparkConf().setAppName("HelloWorld").setMaster("local") val sc = new SparkContext(conf) conf.set("es.index.auto.create", "true") val spark = SparkSession .builder() .appName("Spark SQL basic example") .config("spark.some.config.option", "some-value") .getOrCreate() val jsonpath = "/home/aymenstien/Bureau/mydoc/Orange.json" //val ds= spark.read.json(jsonpath) sc.esJsonRDD(jsonpath) val RDD = sc.esRDD("radio/artists") //rddds.saveToEs("jsontoes/json-trips") //sc.makeRDD(Seq(ds)).saveToEs("jsontoEs/docs") } } <br>