ropensci / elastic

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

Question - Support for ignore_unavailable? #273

Closed sarthi2395 closed 3 years ago

sarthi2395 commented 3 years ago

Elastic version: 7.4.2 (AWS ElasticSearch service)

Session Info ```r - Session info ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- setting value version R version 3.5.2 (2018-12-20) os Windows >= 8 x64 system x86_64, mingw32 ui RStudio language (EN) collate English_United States.1252 ctype English_United States.1252 tz Asia/Calcutta date 2020-07-27 - Packages ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ! package * version date lib source assertthat 0.2.1 2019-03-21 [2] CRAN (R 3.4.4) R backports 1.1.4 [2] bitops 1.0-6 2013-08-17 [1] CRAN (R 3.5.2) callr 3.4.3 2020-03-28 [1] CRAN (R 3.5.3) cli 2.0.2 2020-02-28 [1] CRAN (R 3.5.3) crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.3) crul 0.9.0 2019-11-06 [1] CRAN (R 3.5.3) curl 4.3 2019-12-02 [1] CRAN (R 3.5.3) desc 1.2.0 2018-05-01 [2] CRAN (R 3.4.4) devtools 2.3.0 2020-04-10 [1] CRAN (R 3.5.3) digest 0.6.25 2020-02-23 [1] CRAN (R 3.5.3) dplyr * 0.8.5 2020-03-07 [1] CRAN (R 3.5.3) DT 0.14 2020-06-24 [1] CRAN (R 3.5.2) elastic * 1.1.0 2020-01-11 [1] CRAN (R 3.5.3) ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.5.3) fansi 0.4.1 2020-01-08 [1] CRAN (R 3.5.3) fastmap 1.0.1 2019-10-08 [1] CRAN (R 3.5.3) fs 1.3.1 2019-05-06 [2] CRAN (R 3.5.3) glue 1.4.1 2020-05-13 [1] CRAN (R 3.5.2) htmltools 0.5.0 2020-06-16 [1] CRAN (R 3.5.2) htmlwidgets 1.5.1 2019-10-08 [1] CRAN (R 3.5.3) httpcode 0.3.0 2020-04-10 [1] CRAN (R 3.5.3) httpuv 1.5.2 2019-09-11 [1] CRAN (R 3.5.3) jsonlite 1.6.1 2020-02-02 [1] CRAN (R 3.5.3) later 1.0.0 2019-10-04 [1] CRAN (R 3.5.3) lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.5.3) magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.3) memoise 1.1.0 2017-04-21 [2] CRAN (R 3.4.4) mime 0.9 2020-02-04 [1] CRAN (R 3.5.3) pillar 1.4.6 2020-07-10 [1] CRAN (R 3.5.2) pkgbuild 1.0.8 2020-05-07 [1] CRAN (R 3.5.2) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.5.3) pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.3) prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.5.3) processx 3.4.2 2020-02-09 [1] CRAN (R 3.5.3) promises 1.1.0 2019-10-04 [1] CRAN (R 3.5.3) ps 1.3.2 2020-02-13 [1] CRAN (R 3.5.3) purrr * 0.3.4 2020-04-17 [1] CRAN (R 3.5.3) R6 2.4.1 2019-11-12 [1] CRAN (R 3.5.3) Rcpp 1.0.4.6 2020-04-09 [1] CRAN (R 3.5.3) RCurl * 1.98-1.2 2020-04-18 [1] CRAN (R 3.5.3) remotes 2.1.1 2020-02-15 [1] CRAN (R 3.5.3) rlang 0.4.5 2020-03-01 [1] CRAN (R 3.5.3) rprojroot 1.3-2 2018-01-03 [2] CRAN (R 3.4.4) rstudioapi 0.11 2020-02-07 [1] CRAN (R 3.5.3) sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 3.4.4) shiny 1.5.0 2020-06-23 [1] CRAN (R 3.5.2) testthat 2.3.2 2020-03-02 [1] CRAN (R 3.5.3) tibble 3.0.1 2020-04-20 [1] CRAN (R 3.5.3) tidyselect 1.0.0 2020-01-27 [1] CRAN (R 3.5.3) triebeard 0.3.0 2016-08-04 [1] CRAN (R 3.5.3) urltools 1.7.3 2019-04-14 [1] CRAN (R 3.5.3) usethis 1.6.1 2020-04-29 [1] CRAN (R 3.5.2) vctrs 0.2.4 2020-03-10 [1] CRAN (R 3.5.3) withr 2.2.0 2020-04-20 [1] CRAN (R 3.5.3) xml2 * 1.3.2 2020-04-23 [1] CRAN (R 3.5.3) xtable 1.8-4 2019-04-21 [2] CRAN (R 3.5.3) yaml 2.2.1 2020-02-01 [1] CRAN (R 3.5.3) ```

Here is a sample query that I run against my indices.

Search(x, index = c("index1", "index2", "index3"), q = "Test", size = 1000)$hits$hits

This works fine if all the three indices are present. Even if one of them is not present, I get

Error: 404 - no such index [index3]

In Elastic search API documentation here, I see that there is a parameter ignore_unavailable which when passed as TRUE will ignore missing indices and return the results only for those that are available. This doesn't work when I pass the same to my search query as follows:

Search(x, index = c("index1", "index2", "index3"), q = "Test", size = 1000, ignore_unavailable = TRUE)$hits$hits

Is there a way I can achieve this?

sckott commented 3 years ago

Thanks for the issue. I don't see it in the rendered docs for Elasticsearch, which is weird, but I tried adding the parameter and it does seem to work, so I'll push that up.

Note that the ellipsis (...) is meant for curl options as the docs state, but unfortunately allows non curl options to be passed and silently ignored.

sckott commented 3 years ago

added the parameter, re-install and try again

sarthi2395 commented 3 years ago

I removed the package, installed from GitHub and tried again. Still doesn't seem to work.

sckott commented 3 years ago

Did you restart R?