mtermvectors: Multi Termvectors

Description Usage Arguments Details References Examples

View source: R/mtermvectors.R

Description

Multi Termvectors

Usage

1
2
3
4
5
mtermvectors(index = NULL, type = NULL, ids = NULL, body = list(),
  pretty = TRUE, field_statistics = TRUE, fields = NULL,
  offsets = TRUE, parent = NULL, payloads = TRUE, positions = TRUE,
  preference = "random", realtime = TRUE, 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.

ids

(character) One or more document ids

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

preference

(character) Specify the node or shard the operation should be performed on (Default: random).

realtime

(character) Specifies if request is real-time as opposed to near-real-time (Default: TRUE).

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 httr::POST()

Details

Multi termvectors API allows to get multiple termvectors based on an index, type and id.

References

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

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
## 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)

ropensci/elastic documentation built on Aug. 11, 2018, 3:46 a.m.