
Last chance! 50% off unlimited learning
Sale ends in
Create a document
docs_create(index, type, id, body, version = NULL, version_type = NULL,
op_type = NULL, routing = NULL, parent = NULL, timestamp = NULL,
ttl = NULL, refresh = NULL, timeout = NULL, callopts = list(), ...)
(character) The name of the index. Required
(character) The type of the document. Required
(numeric/character) The document ID. Can be numeric or character. Required
The document.
(character) Explicit version number for concurrency control
(character) Specific version type. One of internal, external, external_gte, or force
(character) Operation type. One of create, or ...
(character) Specific routing value
(numeric) A parent document ID
(date) Explicit timestamp for the document
(aka “time to live”) Expiration time for the document. Expired documents will be expunged automatically. The expiration date that will be set for a document with a provided ttl is relative to the timestamp of the document, meaning it can be based on the time of indexing or on any time provided. The provided ttl must be strictly positive and can be a number (in milliseconds) or any valid time value (e.g, 86400000, 1d).
(logical) Refresh the index after performing the operation
(character) Explicit operation timeout, e.g,. 5m (for 5 minutes)
Curl options passed on to PUT
Further args to query DSL
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
# NOT RUN {
connect()
if (!index_exists('plos')) {
plosdat <- system.file("examples", "plos_data.json", package = "elastic")
invisible(docs_bulk(plosdat))
}
docs_create(index='plos', type='article', id=1002,
body=list(id="12345", title="New title"))
# and the document is there now
docs_get(index='plos', type='article', id=1002)
# }
Run the code above in your browser using DataLab