# SparkSQL + ElasticSeaerch = Cannot find mapping

**URL:** <https://discuss.elastic.co/t/sparksql-elasticseaerch-cannot-find-mapping/47416>\
**Category:** Elasticsearch\
**Created:** [April 14, 2016, 4:41pm UTC](https://discuss.elastic.co/t/sparksql-elasticseaerch-cannot-find-mapping/47416 "2016-04-14T16:41:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbranco](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jbranco](https://discuss.elastic.co/u/jbranco)\
**Post date:** [April 14, 2016, 4:41pm UTC](https://discuss.elastic.co/t/sparksql-elasticseaerch-cannot-find-mapping/47416/1 "2016-04-14T16:41:21Z")

</div>

Hi,

I recently started to use elasticsearch-hadoop library which allows me to use sqlContext to retrieve the data from ElasticSearch into a DataFrame.

My index is players and type is football.

When I run the below code:

```
val esConfig =......
sqlContext.esDF("players/football", esConfig) 

```

throws a ESHadoopIllegalArgument Exception : Cannot find mapping for "players/football" - one is required before using Spark SQL.

However, my type already has a mapping which is working fine:  
/players/football/\_mapping

```
players:{
      mappings:{
              football:{
                      properties: {
                             name:{
                                  type:"string"
                            }
                      }
              }
     }
}

```

Has anyone encountered this issue before or has any suggestions on how to tackle this?

Regards

---

<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 5, 2017, 10:59pm UTC](https://discuss.elastic.co/t/sparksql-elasticseaerch-cannot-find-mapping/47416/2 "2017-07-05T22:59:07Z")

</div>


