AlexIoannides / elasticsearchr

Lightweight Elasticsearch client for R.
https://alexioannides.com/2016/11/28/elasticsearchr-a-lightweight-elasticsearch-client-for-r/
54 stars 19 forks source link

Secure connection [x-pack] #56

Open regisoc opened 5 years ago

regisoc commented 5 years ago

We cannot connect to a secure ES.

To reproduce:

# get one docker version of ES with active security
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:5.6.16

# error, will not connect
curl -X GET http://localhost:9200

# ok, with default credentials
curl -X GET http://localhost:9200 --user elastic:changeme

Result: image

AlexIoannides commented 5 years ago

New functionality required here. I doubt that it'd take much effort to pass the authentication details through to ES (via the httpr commands), but there is probably a small amount of design work required, too.

peterschretlen commented 4 years ago

I think there is a workaround: set the authentication in the global httr config? It's not ideal if you're using httr elsewhere, but if elasticsearch is the only connection being made it will work ok:

httr::set_config(authenticate("elastic","changeme"))

elastic("https://localhost:9200", "mpg") %index% mpg