# NOT RUN {
x <- connect()
if (!index_exists(x, 'plos')) {
plosdat <- system.file("examples", "plos_data.json",
package = "elastic")
plosdat <- type_remover(plosdat)
invisible(docs_bulk(x, plosdat))
}
if (!index_exists(x, 'omdb')) {
omdb <- system.file("examples", "omdb.json", package = "elastic")
omdb <- type_remover(omdb)
invisible(docs_bulk(x, omdb))
}
body <- '{
"fields" : ["title"],
"offsets" : true,
"positions" : true,
"term_statistics" : true,
"field_statistics" : true
}'
termvectors(x, 'plos', id = 29, body = body)
body <- '{
"fields" : ["Plot"],
"offsets" : true,
"positions" : true,
"term_statistics" : true,
"field_statistics" : true
}'
termvectors(x, 'omdb', id = Search(x, "omdb", size=1)$hits$hits[[1]]$`_id`,
body = body)
# }
Run the code above in your browser using DataLab