elasticizer: added additional verbosity on errors

master
Erik de Vries 6 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)
)
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,9 +92,11 @@ 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)
)
if (attempt > 1) {
print(paste0('Successful after ',attempt,' attempts'))
}
}
}
json <- fromJSON(res)
if (json$hits$total$value == 0) {
scroll_clear(conn = conn, x = json$`_scroll_id`)
@ -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,8 +121,10 @@ 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)
)
if (attempt > 1) {
print(paste0('Successful after ',attempt,' attempts'))
}
}
json <- fromJSON(res)
hits <- length(json$hits$hits)
if(hits > 0) {

Loading…
Cancel
Save