ropensci / elastic

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

docs_bulk curl send failure: Connection reset by peer #272

Closed christinabrady closed 4 years ago

christinabrady commented 4 years ago

I have an Elasticsearch instance (v 6.2) on RHEL 7.7. Using the elastic package (v1.1.0) on R version 3.6.0, on the same RHEL server I am able to query elasticsearch, but I cannot push docs to elasticsearch using docs_bulk. It throws the following error:

Error in curl::curl_fetch_memory(x$url$url, handle = x$url$handle) : Send failure: Connection reset by peer

I have tried the following:

  1. Specify server name in connect() call.
  2. Use default connect() call.
  3. Add docs to an existing index.
  4. Create a new index.

I am able to push docs to the above mentioned elasticsearch instance using docs_bulk from a Windows machine running Windows 7, R 3.6.2 and elastic package v 1.1.0.

Session info and code examples are below.

Session Info (does not work) R version 3.6.0 (2019-04-26) Platform: x86_64-redhat-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux Server 7.7 (Maipo) Matrix products: default BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] elastic_1.1.0 loaded via a namespace (and not attached): [1] compiler_3.6.0 R6_2.4.1 httpcode_0.2.0 curl_4.3 crul_0.9.0 [6] jsonlite_1.6 Session Info (works) R version 3.6.2 (2019-12-12) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] dplyr_0.8.3 elastic_1.1.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.3 crayon_1.3.4 assertthat_0.2.1 crul_0.9.0 R6_2.4.1 jsonlite_1.6 magrittr_1.5 pillar_1.4.3 rlang_0.4.2 curl_4.3 [11] urltools_1.7.3 tools_3.6.2 glue_1.3.1 triebeard_0.3.0 purrr_0.3.3 compiler_3.6.2 pkgconfig_2.0.3 tidyselect_0.2.5 tibble_2.1.3 httpcode_0.2.0 Example code ```r library(elastic) tmp <- data.frame(states = state.abb) escon <- connect() docs_bulk(conn = escon, x = tmp, index = "test", type = "docs") ```

Any help debugging this would be much appreciated!

sckott commented 4 years ago

thanks for the issue @christinabrady - sorry for the delay.

That's a quite generic error, so need to dig in a bit more. Try again after settting connect(errors = "complete") along with any other connection details you use. That should give you verbose error messages from your Elasticsearch instance, if any.

It's possible curl versions are different on your RHEL machine vs. the windows machine. I'd look to see if those are different.

christinabrady commented 4 years ago

Thanks for the reply. Apologies for the delay in getting back to you. The issue seems to have been the version of the underlying curl package. It was several versions behind on the RHEL server. I updated it and can push to ES from R using docs_bulk now.

Thank you!

sckott commented 4 years ago

nice job figuring it out!