title: Connecting with R to elasticsearch https with certificate
body: <p>I am trying to connect with R to an elasticsearch https instance which requires a certificate.</p>
  
  <p>If I use curl to test if the certificate is correct, it works:</p>
  
  <pre><code>curl  'https://username:password@10.x.x.x:9200/_cat/health?v' --cacert /home/username/ca.crt
  </code></pre>
  
  <p>But if I try from R using elastic pkg and httr I get the error:</p>
  
  <blockquote>
  <pre><code>Error in curl::curl_fetch_memory(url, handle = handle) : 
    Server returned nothing (no headers, no data)
  </code></pre>
  </blockquote>
  
  <p>Here is the R code:</p>
  
  <pre><code>library(elastic)
  library(httr)
  
  set_config(config(cainfo = "/home/username/ca.crt"))
  
  connect(es_host = "10.x.x.x", es_port = 9200, es_user = "username", es_pwd = "password")
  
  elastic::count(index = "indexname-*", type = "datatype")
  
  ml_get &lt;- Search(index = "indexname-*", size = 1, raw = TRUE)
  </code></pre>
  
  <p>I tried using <code>https://ip_address</code> but am still getting the same results.
  Please let me know what I am doing wrong and your advise.</p>