Learn R Programming

elastic (version 0.7.6)

termvectors: Termvectors

Description

Termvectors

Usage

termvectors(index, type, id = NULL, body = list(), pretty = TRUE, field_statistics = TRUE, fields = NULL, offsets = TRUE, parent = NULL, payloads = TRUE, positions = TRUE, realtime = TRUE, preference = "random", routing = NULL, term_statistics = FALSE, version = NULL, version_type = NULL, ...)

Arguments

index
(character) The index in which the document resides.
type
(character) The type of the document.
id
(character) The id of the document, when not specified a doc param should be supplied.
body
(character) Define parameters and or supply a document to get termvectors for
pretty
(logical) pretty print. Default: TRUE
field_statistics
(character) Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Default: TRUE
fields
(character) A comma-separated list of fields to return.
offsets
(character) Specifies if term offsets should be returned. Default: TRUE
parent
(character) Parent id of documents.
payloads
(character) Specifies if term payloads should be returned. Default: TRUE
positions
(character) Specifies if term positions should be returned. Default: TRUE
realtime
(character) Specifies if request is real-time as opposed to near-real-time (Default: TRUE).
preference
(character) Specify the node or shard the operation should be performed on (Default: random).
routing
(character) Specific routing value.
term_statistics
(character) Specifies if total term frequency and document frequency should be returned. Default: FALSE
version
(character) Explicit version number for concurrency control
version_type
(character) Specific version type, valid choices are: 'internal', 'external', 'external_gte', 'force'
...
Curl args passed on to POST

Details

Returns information and statistics on terms in the fields of a particular document. The document could be stored in the index or artificially provided by the user (Added in 1.4). Note that for documents stored in the index, this is a near realtime API as the term vectors are not available until the next refresh.

References

http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html

Examples

Run this code
## Not run: 
# connect()
# if (!index_exists('plos')) {
#   plosdat <- system.file("examples", "plos_data.json", package = "elastic")
#   docs_bulk(plosdat)
# }
# if (!index_exists('omdb')) {
#   omdb <- system.file("examples", "omdb.json", package = "elastic")
#   docs_bulk(omdb)
# }
# 
# body <- '{
#   "fields" : ["title"],
#   "offsets" : true,
#   "positions" : true,
#   "term_statistics" : true,
#   "field_statistics" : true
# }'
# termvectors('plos', 'article', 29, body = body)
# 
# body <- '{
#   "fields" : ["Plot"],
#   "offsets" : true,
#   "positions" : true,
#   "term_statistics" : true,
#   "field_statistics" : true
# }'
# termvectors('omdb', 'omdb', 'AVXdx8Eqg_0Z_tpMDyP_', body = body)
# ## End(Not run)

Run the code above in your browser using DataLab