# Connectivity of R and Elasticsearch

**URL:** <https://discuss.elastic.co/t/connectivity-of-r-and-elasticsearch/102403>\
**Category:** Elasticsearch\
**Created:** [October 2, 2017, 5:16am UTC](https://discuss.elastic.co/t/connectivity-of-r-and-elasticsearch/102403 "2017-10-02T05:16:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bolosh](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@Bolosh](https://discuss.elastic.co/u/Bolosh)\
**Post date:** [October 2, 2017, 5:16am UTC](https://discuss.elastic.co/t/connectivity-of-r-and-elasticsearch/102403/1 "2017-10-02T05:16:33Z")

</div>

Hi I have a problems making R to work with Elasticsearch via ssh tunnelling on CentOS 7. SSH tunnel is already setup via putty.  
I have installed Rstudio and R (server). I connect to Elasticsearch:

connect(es\_host = "\<host\_address\>",es\_port = "9200",es\_path = "")

When I try to use ping(), I get following error:

> ping()  
> Error: lexical error: invalid char in json text.  
> \<!DOCTYPE HTML PUBLIC "-//W3C//  
> (right here) ------^

Is it problem with connection, elasticsearch, incompatibility...?

1. Proxy is set up in Renviron.site file as:

http\_proxy = \<http\_address\>:  
http\_proxy\_user=user:pass

https\_proxy = \<http\_address\>:  
https\_proxy\_user=user:pass

1. R version: 3.4.1 Rstudio version: 1.0.44

2. Elasticsearch version: 2.3.3

I will appreciate any advice. Thanks,

Leon

---

<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:** [October 2, 2017, 5:26am UTC](https://discuss.elastic.co/t/connectivity-of-r-and-elasticsearch/102403/2 "2017-10-02T05:26:06Z")

</div>

It looks like a proxy issue, can you try it without the proxy?

---

<div class="post-metadata">

**Author:** ![Bolosh](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@Bolosh](https://discuss.elastic.co/u/Bolosh)\
**Post date:** [October 2, 2017, 5:54am UTC](https://discuss.elastic.co/t/connectivity-of-r-and-elasticsearch/102403/3 "2017-10-02T05:54:58Z")

</div>

Thanks for reply Mark,  
When I comment out proxy lines in Renviron.site,  
I get following back:  
"Error in curl::curl\_fetch\_memory(url, handle = handle) :  
Could not resolve host: ; Name or service not known"  
Kind Regards,  
Leon

---

<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:** [October 30, 2017, 5:55am UTC](https://discuss.elastic.co/t/connectivity-of-r-and-elasticsearch/102403/4 "2017-10-30T05:55:03Z")

</div>

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