elasticizer: update to account for syntax change in newer package versions

master
Erik de Vries 5 years ago
parent f6006eb9ba
commit f2312f65d5

@ -22,23 +22,45 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
retries <- 10 ### Number of retries on error
sleep <- 30 ### Number of seconds between retries
httr::set_config(httr::config(http_version = 0))
if (localhost == F) {
connect(es_port = 443,
es_transport = 'https',
es_host = 'linux01.uis.no',
es_path = 'es',
es_user = 'es',
es_pwd = es_pwd,
errors = 'complete')
}
if (localhost == T){
connect(es_port = 9200,
es_transport = 'http',
es_host = 'localhost',
es_path = '',
es_user = '',
es_pwd = '',
errors = 'complete')
## Transitional code for syntax change in elastic package
if (packageVersion("elastic") < 1) {
if (localhost == F) {
connect(es_port = 443,
es_transport = 'https',
es_host = 'linux01.uis.no',
es_path = 'es',
es_user = 'es',
es_pwd = es_pwd,
errors = 'complete')
}
if (localhost == T){
connect(es_port = 9200,
es_transport = 'http',
es_host = 'localhost',
es_path = '',
es_user = '',
es_pwd = '',
errors = 'complete')
}
} else {
if (localhost == F) {
connect(port = 443,
transport = 'https',
host = 'linux01.uis.no',
path = 'es',
user = 'es',
pwd = es_pwd,
errors = 'complete')
}
if (localhost == T){
connect(port = 9200,
transport = 'http',
host = 'localhost',
path = '',
user = '',
pwd = '',
errors = 'complete')
}
}
# Get all results - one approach is to use a while loop
if (src == T) {

Loading…
Cancel
Save