# Spark SQL and standalone config

**URL:** <https://discuss.elastic.co/t/spark-sql-and-standalone-config/53572>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [June 21, 2016, 8:53pm UTC](https://discuss.elastic.co/t/spark-sql-and-standalone-config/53572 "2016-06-21T20:53:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serge\_Semichev](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@Serge\_Semichev](https://discuss.elastic.co/u/Serge_Semichev)\
**Post date:** [June 21, 2016, 8:53pm UTC](https://discuss.elastic.co/t/spark-sql-and-standalone-config/53572/1 "2016-06-21T20:53:38Z")

</div>

Working in Databricks environment where sqlContext is already exist, I can use standalone config only, like

var config: Map[String,String] = Map()  
config += ("es.nodes" -\> "es-node-address")  
config += ("es.resource" -\> persons/person")

To read data to RDD I can use this code

```
val persons = sc.esRDD(config)
persons.count

```

But it cannot be converted to data frame - persons.toDF, due to error "Schema for type scala.AnyRef is not supported".

How can I use my standalone config to load data to data frame? It seems that "load" method of spark.sql.DataFrameReader doesn't have an overloaded version for a custom Map.

```
import org.elasticsearch.spark.sql._

// DataFrame schema automatically inferred
val df = sqlContext.read.format("es").load("buckethead/albums")

// operations get pushed down and translated at runtime to Elasticsearch QueryDSL
val playlist = df.filter(df("category").equalTo("pikes").and(df("year").geq(2016)))
```

---

<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:** [July 6, 2017, 1:24pm UTC](https://discuss.elastic.co/t/spark-sql-and-standalone-config/53572/2 "2017-07-06T13:24:14Z")

</div>

Closed on July 6, 2017, 1:24pm UTC


