Closed ebdavison closed 6 years ago
thx for the question @ebdavison
this is beyond scope of this package I think, but here's a reproducible example using whisker:
library(elastic)
library(whisker)
elastic::connect()
shakespeare <- system.file("examples", "shakespeare_data.json", package = "elastic")
if (!index_exists("shakespeare")) invisible(docs_bulk(shakespeare))
x <- 'KING HENRY IV'
Search(index = "shakespeare",
q = whisker.render("speaker: {{x}}", list(x = x)),
size = 10,
body = '{"_source": ["play_name", "speaker"]}', asdf = TRUE)
x <- 'FALSTAFF'
Search(index = "shakespeare",
q = whisker.render("speaker: {{x}}", list(x = x)),
size = 10,
body = '{"_source": ["play_name", "speaker"]}', asdf = TRUE)
help?
Perfect!!! That is exactly what I needed and works perfectly.
Thanks.
great , glad it works
I need to be able to search for a set of documents where a particular field matches.
My code is like:
But I have not been able to make this work with either a fixed string 'customer=example' nor can I figure out how to use the R variable as a replacement.
This sort of example is not in the documentation and I need to be able to subset this based on an R variable as I produce a report from Rmarkdown using elastic to gather info for graphs and such.