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

How to enter API key to connect to elastic instance #221

Open
sebastiz opened this issue May 26, 2021 · 1 comment
Open

How to enter API key to connect to elastic instance #221

sebastiz opened this issue May 26, 2021 · 1 comment

Comments

@sebastiz
Copy link

I wanted to use your packed to connect but I'm not sure which parameters to use within the connect function especially to include the API key with the headers etc I am using in the httr::GET request below

At the moment Im trying to search with httr using code similar to this:

library(httr)
library(RJSONIO)
library(curl)

my_query <- rjson::toJSON(
'{
"query": {
"match" : {
"LastName": "MyName"
}
}
}'
)

get_scroll_id <- httr::GET(
url = "https://MyServer:9200/MyIndex/_search",
query = list(scroll = "1m", size = "10000"),
encoding = 'json',
httr::add_headers(
.headers = c(
"Authorization" = "ApiKey ****",
"Content-Type" = "application/json"
)
),
config=httr::config(ssl_verifypeer = FALSE,ssl_verifyhost = FALSE),
body = my_query
)

scroll_data <- fromJSON(content(get_scroll_id, as="text"))

This returns data but doesn't let me run a query for reasons I don't understand. Hence why I wanted to use your package. Thanks in advance

@jameslamb
Copy link
Collaborator

Thanks for using {uptasticsearch}!

doesn't let me run a query for reasons I don't understand

Can you provide any logs or error messages that could help us to understand more specifically what is happening? There are many different situations which could be described as "doesn't let me run a query".

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