Hello,
I'm encountering an issue while trying to load data from Elasticsearch into Databricks. Below is the code I'm using and the error message I'm receiving.
Code:
es_read_conf = {
"es.nodes": "your-cluster-url",
"es.port": "443",
"es.net.http.auth.header": "Authorization: ApiKey <your-api-key>",
"es.resource": "b-s-data",
"es.net.ssl": "true",
"es.nodes.wan.only": "true"
}
df = spark.read.format("org.elasticsearch.spark.sql").options(**es_read_conf).load("beat-starnet-data")
display(df)
Error:
kotlin
Py4JJavaError: An error occurred while calling o492.load.
: org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: Cannot detect ES version - typically this happens if the network/Elasticsearch cluster is not accessible or when targeting a WAN/Cloud instance without the proper setting 'es.nodes.wan.only'
at org.elasticsearch.hadoop.rest.InitializationUtils.discoverClusterInfo(InitializationUtils.java:403)
at org.elasticsearch.spark.sql.ElasticsearchRelation.cfg$lzycompute(DefaultSource.scala:234)
...
Caused by: org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest: org.elasticsearch.hadoop.rest.EsHadoopRemoteException: security_exception: missing authentication credentials for REST request [/]
Details:
- The Elasticsearch cluster is accessible, as verified by basic connectivity tests.
- The cluster status is
yellow
, but there are no signs of connectivity issues. - I am using the correct version of the Elasticsearch-Hadoop connector for Elasticsearch 8.6.2.
Questions:
- Main Error: The primary error is
security_exception: missing authentication credentials for REST request [/
. What could be causing this authentication issue? - Configuration: Are there additional settings or adjustments needed for proper integration with a cloud-based Elasticsearch cluster?
Any guidance or suggestions on resolving this issue would be greatly appreciated.
Thank you!