# Save json file to elasticsearch using spark?

**URL:** https://discuss.elastic.co/t/save-json-file-to-elasticsearch-using-spark/141168
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [July 23, 2018, 12:12pm UTC](https://discuss.elastic.co/t/save-json-file-to-elasticsearch-using-spark/141168 "2018-07-23T12:12:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Aymen\_Rahal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aymen_rahal/32/44720_2.png) [@Aymen\_Rahal](https://discuss.elastic.co/u/Aymen_Rahal)
#### Post date: [July 23, 2018, 12:12pm UTC](https://discuss.elastic.co/t/save-json-file-to-elasticsearch-using-spark/141168/1 "2018-07-23T12:12:56Z")

</div>

I am trying to save a json file to Elasticsearch, I am getting this error (Exception in thread "main" java.lang.AbstractMethodError) I am using "spark 2.3.0" and "scala 2.11.6" please find the code Below:  
//  
import org.apache.spark.sql.SQLContext  
import org.elasticsearch.spark.sql.\_

import org.apache.spark.{SparkConf, SparkContext}

object OrangetoES {

def main(args: Array[String]) {  
val conf = new SparkConf().setAppName("OrangetoES").setMaster("local[\*]")  
val sc = new SparkContext(conf)  
conf.set("es.index.auto.create", "true")  
val sqlc = new SQLContext(sc)  
val df = sqlc.read.json("../Orange.json")  
df.saveToEs("orangetoes/people")

}

}  
//

help me to solve this problem

---

<div class="post-metadata">

### Author: ![james.baiera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james.baiera/32/10209_2.png) [@james.baiera](https://discuss.elastic.co/u/james.baiera)
#### Post date: [July 25, 2018, 3:00pm UTC](https://discuss.elastic.co/t/save-json-file-to-elasticsearch-using-spark/141168/2 "2018-07-25T15:00:54Z")

</div>

Can you include the full exception trace and message text here?

---

<div class="post-metadata">

### Author: ![Aymen\_Rahal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aymen_rahal/32/44720_2.png) [@Aymen\_Rahal](https://discuss.elastic.co/u/Aymen_Rahal)
#### Post date: [July 29, 2018, 8:20pm UTC](https://discuss.elastic.co/t/save-json-file-to-elasticsearch-using-spark/141168/3 "2018-07-29T20:20:02Z")

</div>

thanks @james.baiera it work fine now 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 26, 2018, 8:20pm UTC](https://discuss.elastic.co/t/save-json-file-to-elasticsearch-using-spark/141168/4 "2018-08-26T20:20:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
