You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.3 KiB
29 lines
1.3 KiB
#' Push a line-delimited JSON string to Elasticsearch as bulk update
|
|
#'
|
|
#' Push a line-delimited JSON string to Elasticsearch as bulk update
|
|
#' @param x Line-delimited JSON suitable for use as Elasticsearch bulk update
|
|
#' @param es_super The even-more-secret (do not store this anywhere!!!) password for updating (or messing up!) the entire database
|
|
#' @return An html response object indicating the status of the update
|
|
#' @export
|
|
#' @examples
|
|
#' elastic_update(x, es_super = 'secret')
|
|
|
|
#################################################################################################
|
|
#################################### Elasticsearch Updater ################################
|
|
#################################################################################################
|
|
elastic_update <- function(x, es_super = 'secret') {
|
|
bulk <- paste0(x,'\n')
|
|
url <- paste0('https://super:',es_super,'@linux01.uis.no/es/_bulk?pretty&refresh=wait_for')
|
|
res <- RETRY("POST", url = url
|
|
, body = bulk
|
|
, encode = "raw"
|
|
, add_headers("Content-Type" = "application/json")
|
|
, times = 10
|
|
, pause_min = 10
|
|
)
|
|
# stop_for_status(res)
|
|
# content(res, "parsed", "application/json")
|
|
# appData <- content(res)
|
|
return(res)
|
|
}
|