Elasticsearch spark connection for Structured Streaming

I'm trying to make a connection to elasticsearch from my spark program.
My elasticsearch host is https and found no connection property for that.
We are using spark structred streaming Java API and the connection details are as follows,

		SparkSession spark = SparkSession.builder()
				.config(ConfigurationOptions.ES_NET_HTTP_AUTH_USER, "username")
				.config(ConfigurationOptions.ES_NET_HTTP_AUTH_PASS, "password")
				 .config(ConfigurationOptions.ES_NODES, "my_host_url")
				 .config(ConfigurationOptions.ES_PORT, "9200")
.config(ConfigurationOptions.ES_NET_SSL_TRUST_STORE_PASS,"my_password") .config(ConfigurationOptions.ES_NET_SSL_KEYSTORE_TYPE,"jks")

And I'm getting the following error

19/07/01 12:26:00 INFO HttpMethodDirector: I/O exception (org.apache.commons.httpclient.NoHttpResponseException) caught when processing request: The server 10.xx.xxx.xxx failed to respond
19/07/01 12:26:00 INFO HttpMethodDirector: Retrying request
19/07/01 12:26:00 ERROR NetworkClient: Node [10.xx.xxx.xxx:9200] failed (The server 10.xx.xxx.xxx failed to respond); no other nodes left - aborting...
19/07/01 12:26:00 ERROR StpMain: Error
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:344)

Probably it's because it tries to initiate connection by http protocol but in my case I need https connection and not sure how to configure that

The error happened as spark was not able to locate the truststore file.
It seems we need to add "file:\" for the path to be accepted.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.