R/term.R

Defines functions term_ term

Documented in term term_

#' term dsl
#'
#' @export
#' @param .obj An index object. If nothing passed defaults to all indices, equivalent to
#' doing e.g., \code{localhost:9200/_search}
#' @param .dots Explanation...
#' @param ... Further args passed on
#' @examples \dontrun{
#' elastic::connect(errors = "complete")
#'
#' index("shakespeare") %>% term(speaker = FALSTAFF)
#' }
term <- function(.obj=list(), ...) {
  term_(.obj, .dots = lazyeval::lazy_dots(...))
}

#' @export
#' @rdname term
term_ <- function(.obj=list(), ..., .dots) {
  pipe_autoexec(toggle = TRUE)
  dots <- lazyeval::all_dots(.dots, ...)
  query <- as.json(structure(dots, class = c("term", "lazy_dots")))
  query
  #structure(list(index = .obj, query = query), class = "esdsl")
}
ropensci/elasticdsl documentation built on May 18, 2022, 9:53 a.m.