termvectors {elastic} | R Documentation |
Termvectors
Description
Termvectors
Usage
termvectors(
conn,
index,
type = NULL,
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
conn |
an Elasticsearch connection object, see |
index |
(character) The index in which the document resides. |
type |
(character) The type of the document. optional |
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: |
field_statistics |
(character) Specifies if document count, sum
of document frequencies and sum of total term frequencies should be
returned. Default: |
fields |
(character) A comma-separated list of fields to return. |
offsets |
(character) Specifies if term offsets should be returned.
Default: |
parent |
(character) Parent id of documents. |
payloads |
(character) Specifies if term payloads should be returned.
Default: |
positions |
(character) Specifies if term positions should be returned.
Default: |
realtime |
(character) Specifies if request is real-time as opposed to
near-real-time (Default: |
preference |
(character) Specify the node or shard the operation
should be performed on (Default: |
routing |
(character) Specific routing value. |
term_statistics |
(character) Specifies if total term frequency and
document frequency should be returned. Default: |
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 crul::verb-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
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html
See Also
Examples
## 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)
## End(Not run)