From 176a8f6de46325ed079d017a7c361e82a06244d9 Mon Sep 17 00:00:00 2001 From: Erik de Vries Date: Mon, 3 Jun 2019 16:22:07 +0200 Subject: [PATCH] elasticizer: added additional verbosity on errors --- R/elasticizer.R | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/R/elasticizer.R b/R/elasticizer.R index 9eb2555..0e353d7 100644 --- a/R/elasticizer.R +++ b/R/elasticizer.R @@ -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)