ropensci / elastic

R client for the Elasticsearch HTTP API
https://docs.ropensci.org/elastic
Other
245 stars 58 forks source link

Do not automatically remove trailing slash #285

Closed nicolas-f closed 1 year ago

nicolas-f commented 2 years ago
Session Info ```r > sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.1 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3 locale: [1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8 LC_PAPER=fr_FR.UTF-8 [8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] elastic_1.2.0 loaded via a namespace (and not attached): [1] compiler_4.1.2 R6_2.5.1 tools_4.1.2 httpcode_0.3.0 curl_4.3.2 Rcpp_1.0.7 urltools_1.7.3 triebeard_0.3.0 crul_1.2.0 jsonlite_1.7.2 ```

The elastic search instance was only working if the trailing slash was used. But the elastic plugin automatically removes the trailing slash and fail to connect to the elastic search instance:

> library(elastic)
> es.host="x.x.x.x"
> es.port=443
> es.transport_schema="https"
> es.user="myuser"
> es.pwd="mypassword"
> es.path="elastic/"
> es.cainfo='/home/myuser/cers/mycert.crt'
> crul::set_verbose()
> conn <- connect(host = es.host, port = es.port, user = es.user, pwd = es.pwd, path=es.path, transport_schema = es.transport_schema, cainfo=es.cainfo)
Normalizing path: stripping trailing slash
> conn$info(verbose=TRUE)
Erreur : 
  Failed to connect to https://x.x.x.x:443/elastic
  Remember to start Elasticsearch before connecting

Maybe there is an option to skip the Normalizing path: stripping trailing slash step ?

Thanks

sckott commented 2 years ago

Thanks for the issue. Are you sure that's why it's failing? Can you try to replicate on the command line or somewhere else to see if it's the trailing slash that's the issue?

nicolas-f commented 2 years ago

Yes I solved it by changing the configuration of the web server by accepting query without the trailing slash.

Its a specific situation where the R elastic client is accessing elastic search through an nginx or apache proxy.

sckott commented 2 years ago

Yes I solved it

So you're all set? does conn$info() work now?

nicolas-f commented 2 years ago

Yes, thanks, I solved it by modifying the web server.

But I created this issue in order to help enhance the library

maelle commented 1 year ago

For info this package is looking for a new maintainer cf #292 :smile_cat:

maelle commented 1 year ago

I see this had been solved by @sckott