I've updated my elasticsearch to version 5.x! And tried to connect my R Studio(with elastic package). But it gives me an error Error: 404 - no such index.
I connect like this:
elastic::connect(es_host = "http://kibana.smasell.com", es_port = "9200/es", es_user = "****", es_pwd = "****")
It gives me:
transport: http
host: kibana.smasell.com
port: 9200/es
path: NULL
username: *****
password: <secret>
errors: simple
headers (names): NULL
And then try to search:
elastic::Search(index = "data_month_2016-01", size =1)
gives me
Error: 404 - no such index
Can somebody help me?
Related
detailed Error i am getting is as below :
` [2.1:58] test.feature:58 - evaluation of 'karate-config.js' failed: javascript function call failed: com.intuit.karate.exception.KarateException:
Create.feature:21 - driver config / start failed: chrome server returned empty list from http://localhost:59435, options: {type=chrome, headless=true, showDriverLog=true, addOptions=["--no-sandbox","--windows-size=1080,1920","--disable-web-security","--credentials_enable_service=false","--profile.password_manager_enabled=false"], pollInterval=1000, pollAttempts=60, port=59435, target=null}
src.smoke.java.com..test: [1.1:30] test.feature:30 - evaluation of 'karate-config.js' failed: javascript function call failed: com.intuit.karate.exception.KarateException:
`
Below is chrome driver options setup, interestingly scripts get executed successfully when headless:false
function configureChromeForUITests(){
var chromePort = parseInt( Math.floor(50000 + Math.random() * Math.floor(15534)),10);
var IntegerType = Java.type('java.lang.Integer');
var chromePortIntObj = new IntegerType(chromePort);
var chromeDriverObject = {
type: 'chrome',
//executable: '/opt/homebrew/bin/chromedriver',
headless:true,
showDriverLog: true,
addOptions: [
'--no-sandbox',
'--windows-size=1080,1920',
'--disable-web-security',
'--credentials_enable_service=false',
'--profile.password_manager_enabled=false'
],
// webDriverSession: chromeSession,
pollInterval:1000,
pollAttempts: 60,
port: chromePortIntObj,
};
Tried giving executable path as executable: '/opt/homebrew/bin/chromedriver'
I am trying to use the Scopus API for the first time. I have the API key and the institution token. However, I am still getting an error, when I try to use it in R on my Mac. Here is my code:
library(rscopus)
set_api_key(MY_KEY)
hdr=inst_token_header(MY_TOKEN)
key=get_api_key()
print(rscopus::get_api_key(), reveal=TRUE)
have_api_key()
auth_info = process_author_name(last_name="Muschelli", first_name="John", verbose=FALSE)
The error message is:
> library(rscopus)
>
> set_api_key(MY_KEY)
> hdr=inst_token_header(MY_TOKEN)
> key=get_api_key()
> print(rscopus::get_api_key(), reveal=TRUE)
[1] "MY_KEY"
> have_api_key()
[1] TRUE
>
> if (have_api_key()) {
+ auth = elsevier_authenticate(api_key=key)
+ }
HTTP specified is: https://api.elsevier.com/authenticate
Warning message:
In elsevier_authenticate(api_key = key) : Forbidden (HTTP 403).
> auth_info = process_author_name(last_name="Muschelli", first_name="John", verbose=FALSE)
$`service-error`
$`service-error`$status
$`service-error`$status$statusCode
[1] "AUTHENTICATION_ERROR"
$`service-error`$status$statusText
[1] "Invalid API Key: valid apikey credentials required."
Error in get_complete_author_info(...) : Service Error
I tried
if (have_api_key()) {
auth = elsevier_authenticate(api_key=key)
}
but I get the error:
HTTP specified is: https://api.elsevier.com/authenticate
Warning message:
In elsevier_authenticate(api_key = key) : Forbidden (HTTP 403).
I have tried using auth_token_header(MY_TOKEN) instead of inst_token_header(MY_TOKEN) but the code is still not working.
I have also taken the following step in my terminal:
export Elsevier_API=MY_KEY > ~/.bash_profile
source ~/.bash_profile
I am still getting the error. However, the combination of key and institution token work here: https://dev.elsevier.com/scopus.html
Can anyone please help me debug this issue?
Thank You!
I figured out the issue. So, the correct way to query would be to pass the headers argument as well:
auth_info = process_author_name(last_name="Muschelli", first_name="John", verbose=FALSE, headers=hdr)
And now the code will work! :)
I have a few scrapes via RSelenium scheduled. Sometimes the scraping failes and i would like to know the reason.
I note that the error Messages (in red) are quite informative, but i dont know how to log them.
Lets say i provided a "non well formed URL".:
tryCatch(
expr = remDr$navigate("i.am.not.an.url"),
error = function(error){
print(error)
# write.table(error, file = ...)
}
)
This is what i get, but it doesnt give much specification on what triggered the error
<simpleError: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.WebDriverException
Further Details: run errorDetails method>
This is more informative - but i dont manage to log it.
Selenium message:Target URL i.am.not.an.url is not well-formed.
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: '9bc48e7a4511', ip: '172.17.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-1087-aws', java.version: '1.8.0_91'
Driver info: driver.version: unknown
What i tried:
Using the Error Handling Class. It includes very detailed specification of the error Messages and its meanings, but i dont manage to extract them given my current error.
errHandle = errorHandler(remDr)
errHandle$checkStatus(remDr)
errHandle$checkError(res = remDr)
Using a message handler from another #SO question:
messageHandler <- function(fun, ...) {
zz <- textConnection("foo", "w", local = TRUE)
sink(zz, type = "message")
res <- fun(...)
sink(type = "message")
close(zz)
#handle messages
list(res, messages = foo)
}
wrongURL <- function() {
remDr$navigate("mistake")
}
messageHandler(fun = wrongURL)
I found a way via errorDetails():
tryCatch(
expr = remDr$navigate("i.am.not.an.url"),
error = function(error){
return(remDr$errorDetails()$localizedMessage)
}
)
While using elastic package in R, I'm getting an message while using connect("172.28.6.5").
Message details :
Found http or https on es_host, stripping off, see the docs .
After this when I am running the command :
res <- Search(index = 'abc_20*', fields = c("Seq_Num"),scroll="5m",search_type = "scan")
It gives me error message :
Error: 404 - IndexMissingException[[abc_20%2A] missing]
This error is only shown in my laptop.
How to resolve this issue?
Is that exactly what you did? I get no issues running that command.
library(elastic)
connect("172.28.6.5")
#> transport: http
#> host: 172.28.6.5
#> port: 9200
#> path: NULL
#> username: NULL
#> password: <secret>
#> errors: simple
#> headers (names): NULL
Looking at the source for elastic::connect(), assuming you've tried updating the package (this block traces back to April 2016)
# strip off transport if found
if (grepl("^http[s]?://", es_host)) {
message("Found http or https on es_host, stripping off, see the docs")
es_host <- sub("^http[s]?://", "", es_host)
}
(note: this is a message not an Error as you have in your question) suggests you're passing in something that regex matches to ^http[s]?://
When I run this command in RStudio,
library(elastic)
connect("192.12.32.2")
The following message/output comes:
Found http or https on es_host, stripping off, see the docs
transport: http
host: 192.12.32.2
port: 9200
path: NULL
username: NULL
password: [secret]
errors: simple
headers (names): NULL
After this I ran this command,
res <- Search(index = 'epgs_20*', fields = c("ts", "ma", "pi", "tn", "Ope"),scroll="5m",search_type = "scan")
and I get the following error:
Error: 404 - IndexMissingException[[epgs_20%2A] missing].
If instead of above index = 'epgs_20*', we use index = 'epgs_2016.2.07'. It works fine but when using * it doesn't work.
How do I run the above command with index = 'epgs_20*' ?