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

**URL:** <https://discuss.elastic.co/t/how-to-create-temporary-tables-in-beeline-sparksql-for-elasticsearch-elasticsearch-is-behind-haproxy/274461>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [May 31, 2021, 7:36am UTC](https://discuss.elastic.co/t/how-to-create-temporary-tables-in-beeline-sparksql-for-elasticsearch-elasticsearch-is-behind-haproxy/274461 "2021-05-31T07:36:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chilaka\_Ramakrishna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chilaka_ramakrishna/32/89477_2.png) [@Chilaka\_Ramakrishna](https://discuss.elastic.co/u/Chilaka_Ramakrishna)\
**Post date:** [May 31, 2021, 7:36am UTC](https://discuss.elastic.co/t/how-to-create-temporary-tables-in-beeline-sparksql-for-elasticsearch-elasticsearch-is-behind-haproxy/274461/1 "2021-05-31T07:36:39Z")

</div>

How to connect beeline to elasticsearch via HAPROXY.

```auto
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

```auto
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

```auto
curl --location --request GET 'https://preview.abc.com/es_cluster_path/' --header 'Authorization: Basic 123absfwoein *****'

```

```auto
{
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"
}

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 31, 2021, 7:48am UTC](https://discuss.elastic.co/t/how-to-create-temporary-tables-in-beeline-sparksql-for-elasticsearch-elasticsearch-is-behind-haproxy/274461/2 "2021-05-31T07:48:14Z")

</div>

Welcome to our community! 😃

> [@Chilaka\_Ramakrishna](#):
>
> `https://preview.abcd.com/es_cluster_path/`

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.

---

<div class="post-metadata">

**Author:** ![Chilaka\_Ramakrishna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chilaka_ramakrishna/32/89477_2.png) [@Chilaka\_Ramakrishna](https://discuss.elastic.co/u/Chilaka_Ramakrishna)\
**Post date:** [May 31, 2021, 8:20am UTC](https://discuss.elastic.co/t/how-to-create-temporary-tables-in-beeline-sparksql-for-elasticsearch-elasticsearch-is-behind-haproxy/274461/3 "2021-05-31T08:20:36Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 28, 2021, 8:20am UTC](https://discuss.elastic.co/t/how-to-create-temporary-tables-in-beeline-sparksql-for-elasticsearch-elasticsearch-is-behind-haproxy/274461/4 "2021-06-28T08:20:46Z")

</div>

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