: 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'
This seems to be a common error posted in these forums, and the typical solutions are:
Set "es.nodes.wan.only" to "true"
Ensure "es.nodes" does not point to a Cloud ID but to an https endpoint
Ensure "es.net.http.auth.user" and "es.net.http.auth.pass" values are correctly set
I've done all of those things, and in the past they were sufficient. In fact, my exact same code and configuration is able to write to an Elasticsearch cluster running version 8.11.3. The new cluster that I need to write to has version 8.13.2, and that's when I get the error, so I suspect something changed between those two versions.
I've tried using several elasticsearch-spark jar versions:
Actually :443 works for all endpoints now, for elasticsearch :9243 is "legacy" but still supported BUT you DO need to add a port otherwise most client libraries will default to the actual default of :9200 so when I see this
I tried .option("es.nodes", "https://example.es.us-west-1.aws.found.io:443") and got the same error.
Is there any way I can turn on verbose logging? Or debug locally without using Spark but using the jar directly, just to test that the connection works?
There ought to be more in the stack trace. Es-hadoop gives that Cannot detect ES version... error message for any exception it catches while trying to connect to the cluster. Sometimes it can be misleading. But the "caused by" portion of the stack trace ought to tell us more.
Switching to the actual, garbled endpoint, like https://sdfgsdfgf52872baf38dfb21236.us-west-1.aws.found.io:443, did the trick.
When I ran your original curl command, I actually didn't get back anything. I also didn't get an error, so I figured everything was fine and not worth mentioning. But when I use the actual endpoint in the curl command, I get back something like the following:
Passing the https://example.es.us-west-1.aws.found.io endpoint to curl when calling the 8.11.3 cluster gives a similar payload to when I use the actual endpoint with the 8.13.2 cluster. Updating my Spark code to point to the real endpoint works too, and I'm able to see data flow through and get added to the index.
How did you know to use the real endpoint and not the cleaner looking endpoint? Is that documented somewhere?
By the way, thank you so much for your fast responses and help. I spent 4 days working on the issue. I'm so relieved it's resolved.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.