SparkSQL + ElasticSeaerch = Cannot find mapping

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

1 Like