# Not able to read from elasticsearch from spark?

**URL:** <https://discuss.elastic.co/t/not-able-to-read-from-elasticsearch-from-spark/144851>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [August 17, 2018, 8:18am UTC](https://discuss.elastic.co/t/not-able-to-read-from-elasticsearch-from-spark/144851 "2018-08-17T08:18:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheryl](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@sheryl](https://discuss.elastic.co/u/sheryl)\
**Post date:** [August 17, 2018, 8:18am UTC](https://discuss.elastic.co/t/not-able-to-read-from-elasticsearch-from-spark/144851/1 "2018-08-17T08:18:20Z")

</div>

using logstash i have ingested file into elastic search with index/type .. car/soldcars  
now for practising i want to read that csv file from spark using scala code.

;val spark= SparkSession.builder.master("local").appName("ReadFromES")  
.config("es.nodes", "localhost").config("es.port",9200).config("es.resoruces","car/soldcars")  
.config("es.index.auto.create","true").getOrCreate()

val es\_df=spark.read.format("org.elasticsearch.spark.sql")  
}

what to do next ?

---

<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:** [August 17, 2018, 8:08pm UTC](https://discuss.elastic.co/t/not-able-to-read-from-elasticsearch-from-spark/144851/2 "2018-08-17T20:08:37Z")

</div>

> [@sheryl](#):
>
> what to do next ?

I'm not sure I understand your question. Once you have a dataframe object, you should be able to define your processing operations on it. Are you seeing a specific inability to connect to Elasticsearch?

> [@sheryl](#):
>
> config("es.resoruces","car/soldcars")

Not sure if this is just a typo in your post, but that should be `es.resource`

---

<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:** [September 14, 2018, 8:08pm UTC](https://discuss.elastic.co/t/not-able-to-read-from-elasticsearch-from-spark/144851/3 "2018-09-14T20:08:40Z")

</div>

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