How to create temporary tables in beeline SparkSQL for ElasticSearch. ElasticSearch is behind HAProxy

How to connect beeline to elasticsearch via HAPROXY.

CREATE TEMPORARY TABLE temp_table USING org.elasticsearch.spark.sql OPTIONS (resource 'temp_index/_doc', nodes 'preview.abc.com', mapping.date.rich 'false', nodes.path.prefix '/es_cluster_path/', net.http.header.Authorization 'Basic 123absfwoein*****');

I am getting the following error

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' (state=,code=0)

but the following works

curl --location --request GET 'https://preview.abc.com/es_cluster_path/' --header 'Authorization: Basic 123absfwoein*****'
{
name: "master-node",
cluster_name: "test_cluster",
cluster_uuid: "xGV5******ikHihaNeHg",
version: {
number: "7.6.1",
build_flavor: "default",
build_type: "deb",
build_hash: "aa7*********e8570670309b1f12348f023b",
build_date: "2020-02-29T00:15:25.529771Z",
build_snapshot: false,
lucene_version: "8.4.0",
minimum_wire_compatibility_version: "6.8.0",
minimum_index_compatibility_version: "6.0.0-beta1"
},
tagline: "You Know, for Search"
}

Welcome to our community! :smiley:

That's not a standard Elasticsearch path, which is probably why it's not working.
You'll need to tell spark what the new path is, but I don't know how to do that.

1 Like

@warkolm , thanks for replying. I have updated the question details. The curl call works @warkolm , which means it is correct URL only ? right ? Please confirm. Thanks.

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