elasticizer: added additional verbosity on errors

master
Erik de Vries 5 years ago
parent d420b02c20
commit 176a8f6de4

@ -69,7 +69,6 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
res <- NULL
attempt <- 0
while( is.null(res) && attempt <= retries ) {
print(paste0('Attempt ',attempt, ' out of ',retries))
if (attempt > 0) {
Sys.sleep(sleep)
}
@ -77,14 +76,15 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
try(
res <- Search(conn = conn, index = index, time_scroll=time_scroll,body = query, size = batch_size, raw=T)
)
print(paste0('Successful after ',attempt,' attempts'))
if (attempt > 1) {
print(paste0('Successful after ',attempt,' attempts'))
}
}
}
if (src == F) {
res <- NULL
attempt <- 0
while( is.null(res) && attempt <= retries ) {
print(paste0('Attempt ',attempt, ' out of ',retries))
if (attempt > 0) {
Sys.sleep(sleep)
}
@ -92,7 +92,9 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
try(
res <- Search(conn = conn, index = index, time_scroll=time_scroll,body = query, size = batch_size, raw=T, source = F)
)
print(paste0('Successful after ',attempt,' attempts'))
if (attempt > 1) {
print(paste0('Successful after ',attempt,' attempts'))
}
}
}
json <- fromJSON(res)
@ -112,7 +114,6 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
res <- NULL
attempt <- 0
while( is.null(res) && attempt <= retries ) {
print(paste0('Attempt ',attempt, ' out of ',retries))
if (attempt > 0) {
Sys.sleep(sleep)
}
@ -120,7 +121,9 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
try(
res <- scroll(conn = conn, json$`_scroll_id`, time_scroll=time_scroll, raw=T)
)
print(paste0('Successful after ',attempt,' attempts'))
if (attempt > 1) {
print(paste0('Successful after ',attempt,' attempts'))
}
}
json <- fromJSON(res)
hits <- length(json$hits$hits)

Loading…
Cancel
Save