Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 403 - action [cluster:monitor/main] is unauthorized for user #275

Closed
rfsaldanha opened this issue Sep 2, 2020 · 4 comments
Closed
Milestone

Comments

@rfsaldanha
Copy link
Contributor

rfsaldanha commented Sep 2, 2020

Hi! I'm getting this error message "Error: 403 - action [cluster:monitor/main] is unauthorized for user"

conn <- connect(
  host = "elastic-leitos.saude.gov.br", 
  transport_schema = "https", 
  port = "", 
  user = "user-api-leitos", 
  pwd = "aQbLL3ZStaTr38tj"
)

Search(conn, index = "leito_ocupacao")

This is a public index, hosted by the Brazilian Ministry of Health, made public with the password. https://opendatasus.saude.gov.br/dataset/registro-de-ocupacao-hospitalar/resource/51f702a4-45f2-437d-9345-d7f93c2f1342

@sckott
Copy link
Contributor

sckott commented Sep 4, 2020

thanks @rfsaldanha

if you do traceback(), you can see Search is pinging the root of the elasticsearch instance to get the version of the instance which is required to know what parameters/etc. are supported.

i may see if in connect() we can toggle a parameter that says to not ping the root of the ES instance, but there's many caes in the pkg that require knowing the ES version. perhaps it will work though

@sckott sckott added this to the v1.2 milestone Sep 4, 2020
sckott added a commit that referenced this issue Sep 4, 2020
ping() and stop_es_version methods check ignore_version param to change their behavior
Search and Search_uri methods use ignore_version to ignore es_ver() checks
and both search fxns now have lenient param default as NULL instead of FALSE
add new tests for ignore_version for connect
@sckott
Copy link
Contributor

sckott commented Sep 4, 2020

re-install like remotes::install_github("ropensci/elastic@ignore-version") and restart R.

should work now if you set ignore_version=TRUE in your connect() call

@sckott sckott closed this as completed Nov 18, 2020
@rfsaldanha
Copy link
Contributor Author

Hi! Thanks for the reply. I'm returning to this again. I'm trying to use the scroll function with the elastic@ignore-version version and getting Error in extractr(ver, "[[:digit:]]+")[[1]] : índice fora de limites.

Bellow a reproducible example. Don't mind about exposing the user and password, they are public.

# remotes::install_github("ropensci/elastic@ignore-version")
library(elastic)

conn <- connect(host = "elasticsearch-saps.saude.gov.br", 
                transport_schema = "https", path = "",  port = "",
                user = "user-public-notificacoes", 
                pwd = "Za4qNXdyQNSa9YaA", 
                ignore_version = TRUE)

index_name <- "desc-notificacoes-esusve-rj"

res <- Search(conn, index = index_name, time_scroll = "5m")
out <- res$hits$hits
hits <- 1
while (hits != 0) {
  res <- scroll(conn, res$`_scroll_id`)
  hits <- length(res$hits$hits)
  if (hits > 0)
    out <- c(out, res$hits$hits)
}
length(out)

@sckott
Copy link
Contributor

sckott commented Jan 6, 2021

Thanks, I'll have a look at the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants