Closed sckott closed 8 years ago
1st question:
The elasticsearch bulk API requires a weird format. It's not proper JSON. Each line ends with a newline, which JSON does not do. I have a few internal functions in the package to create the bulk load format, but for specific data sources - here they are https://github.com/ropensci/elastic/blob/master/R/docs_bulk.r#L298-L339 - I don't think they can really be generalized - but you can modify them easily for your own data.
2nd question:
That example works for me, and returns only 1 result.
library("elastic")
connect()
docs_bulk(mtcars, index = "hello", type = "world")
Search(index="hello", type = "world", q="14.7", size=10)$hits$total
#> [1] 1
What do you get when you try that example? Make sure that the hello
index is not already present. Do index_recreate("hello")
for example before the docs_bulk()
command
closing - just answering email based question here
from a user: