## Not run:
# connect()
# if (!index_exists('omdb')) {
# omdb <- system.file("examples", "omdb.json", package = "elastic")
# docs_bulk(omdb)
# }
#
# # no index or type given
# body <- '{
# "docs": [
# {
# "_index": "omdb",
# "_type": "omdb",
# "_id": "AVXdx8Eqg_0Z_tpMDyP_",
# "term_statistics": true
# },
# {
# "_index": "omdb",
# "_type": "omdb",
# "_id": "AVXdx8Eqg_0Z_tpMDyQ1",
# "fields": [
# "Plot"
# ]
# }
# ]
# }'
# mtermvectors(body = body)
#
# # index given, but not type
# body <- '{
# "docs": [
# {
# "_type": "omdb",
# "_id": "AVXdx8Eqg_0Z_tpMDyP_",
# "fields": [
# "Plot"
# ],
# "term_statistics": true
# },
# {
# "_type": "omdb",
# "_id": "AVXdx8Eqg_0Z_tpMDyQ1",
# "fields": [
# "Title"
# ]
# }
# ]
# }'
# mtermvectors('omdb', body = body)
#
# # index and type given
# body <- '{
# "docs": [
# {
# "_id": "AVXdx8Eqg_0Z_tpMDyP_",
# "fields": [
# "Plot"
# ],
# "term_statistics": true
# },
# {
# "_id": "AVXdx8Eqg_0Z_tpMDyQ1"
# }
# ]
# }'
# mtermvectors('omdb', 'omdb', body = body)
#
# # index and type given, parameters same, so can simplify
# body <- '{
# "ids" : ["AVXdx8Eqg_0Z_tpMDyP_", "AVXdx8Eqg_0Z_tpMDyQ1"],
# "parameters": {
# "fields": [
# "Plot"
# ],
# "term_statistics": true
# }
# }'
# mtermvectors('omdb', 'omdb', body = body)
#
# # you can give user provided documents via the 'docs' parameter
# ## though you have to give index and type that exist in your Elasticsearch instance
# body <- '{
# "docs": [
# {
# "_index": "omdb",
# "_type": "omdb",
# "doc" : {
# "Director" : "John Doe",
# "Plot" : "twitter test test test"
# }
# },
# {
# "_index": "omdb",
# "_type": "omdb",
# "doc" : {
# "Director" : "Jane Doe",
# "Plot" : "Another twitter test ..."
# }
# }
# ]
# }'
# mtermvectors(body = body)
# ## End(Not run)
Run the code above in your browser using DataLab