# NOT RUN {
connect()
if (!index_exists('plos')) {
plosdat <- system.file("examples", "plos_data.json", package = "elastic")
invisible(docs_bulk(plosdat))
}
# Same index and type
docs_mget(index="plos", type="article", ids=c(9,10))
tmp <- docs_mget(index="plos", type="article", ids=c(9, 10),
raw=TRUE)
es_parse(tmp)
docs_mget(index="plos", type="article", ids=c(9, 10),
source='title')
docs_mget(index="plos", type="article", ids=c(14, 19),
source=TRUE)
# curl options
library("httr")
docs_mget(index="plos", type="article", ids=1:2, callopts=verbose())
# Same index, but different types
if (!index_exists('shakespeare')) {
shakedat <- system.file("examples", "shakespeare_data.json", package = "elastic")
invisible(docs_bulk(shakedat))
}
docs_mget(index="shakespeare", type_id=list(c("scene",1), c("line",20)))
docs_mget(index="shakespeare", type_id=list(c("scene",1), c("line",20)),
source='play_name')
# Different indices and different types pass in separately
docs_mget(index_type_id = list(
c("shakespeare", "line", 20),
c("plos", "article", 1)
)
)
# }
Run the code above in your browser using DataLab