Unable to read data from Elasticsearch with spark in Databricks.

Data_Engineer3
Contributor III

When I am trying to read data from elasticsearch by spark sql, it throw an error like

RuntimeException: Error while encoding: java.lang.RuntimeException: scala.collection.convert.Wrappers$JListWrapper is not a valid external type for schema of string

Caused by: RuntimeException: scala.collection.convert.Wrappers$JListWrapper is not a valid external type for schema of string

It show like schema generated with spark is not matching with data received from elasticsearch.

Could you let know how I can read the data from elastic via either csv, or excel format?