Skip to content

Commit

Permalink
#141 fixed bug in docs_bulk and similar one in msearch
Browse files Browse the repository at this point in the history
removed unused function from index.R file
bumped dev version
  • Loading branch information
sckott committed Aug 2, 2016
1 parent 0c25b69 commit ce1622a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Description: Connect to 'Elasticsearch', a 'NoSQL' database built on the 'Java'
requests. In addition, 'elastic' provides functions for interacting with 'APIs'
for 'indices', documents, nodes, clusters, an interface to the cat 'API', and
more.
Version: 0.7.0.9000
Version: 0.7.1.9100
License: MIT + file LICENSE
Authors@R: person("Scott", "Chamberlain", role = c("aut", "cre"),
email = "myrmecocystus@gmail.com")
Expand Down
10 changes: 8 additions & 2 deletions R/docs_bulk.r
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ docs_bulk <- function(x, index = NULL, type = NULL, chunk_size = 1000,
UseMethod("docs_bulk")
}

#' @export
docs_bulk.default <- function(x, index = NULL, type = NULL, chunk_size = 1000,
doc_ids = NULL, es_ids = TRUE, raw = FALSE, ...) {

stop("no 'docs_bulk' method for class ", class(x), call. = FALSE)
}

#' @export
docs_bulk.data.frame <- function(x, index = NULL, type = NULL, chunk_size = 1000,
doc_ids = NULL, es_ids = TRUE, raw = FALSE, ...) {
Expand Down Expand Up @@ -210,8 +217,7 @@ docs_bulk.character <- function(x, index = NULL, type = NULL, chunk_size = 1000,
on.exit(close_conns())
checkconn()
stopifnot(file.exists(x))
conn <- es_get_auth()
url <- paste0(conn$base, ":", conn$port, '/_bulk')
url <- paste0(make_url(es_get_auth()), '/_bulk')
tt <- POST(url, make_up(), es_env$headers, ..., body = upload_file(x, type = "application/json"), encode = "json")
geterror(tt)
res <- cont_utf8(tt)
Expand Down
2 changes: 0 additions & 2 deletions R/index.R
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,6 @@ es_POST_ <- function(index, which, args=NULL, ...){
jsonlite::fromJSON(cont_utf8(tt), FALSE)
}

e_url <- function(x) paste0(x$base, ":", x$port)

analyze_GET <- function(url, args = NULL, ...){
checkconn()
out <- GET(url, query=args, make_up(), es_env$headers, ...)
Expand Down
3 changes: 1 addition & 2 deletions R/msearch.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
msearch <- function(x, raw = FALSE, asdf = FALSE, ...) {
checkconn()
if (!file.exists(x)) stop("file ", x, " does not exist", call. = FALSE)
conn <- es_get_auth()
url <- paste0(conn$base, ":", conn$port, '/_msearch')
url <- paste0(make_url(es_get_auth()), '/_msearch')
tt <- POST(url, make_up(), es_env$headers, ..., body = upload_file(x, type = "application/json"), encode = "json")
geterror(tt)
res <- cont_utf8(tt)
Expand Down

0 comments on commit ce1622a

Please sign in to comment.