create_metadata: Create Bulk API metadata.

Description Usage Arguments Value See Also Examples

View source: R/utils.R

Description

The fastest way to index, delete or update many documents, is via the Bulk API. This requires that each document have the action combined with the document's metadata (index, type and id) sent to the API. This information is encapulated as a JSON object, that this function is responsible for generating.

Usage

1
create_metadata(action, index, doc_type, id = NULL, n = NULL)

Arguments

action

One of: "index", "create", "update" or "delete".

index

The name of the index where the documents reside (or will reside).

doc_type

The name of the document type where the documents reside (or will reside).

id

[optional] Character vector of document ids.

n

[optional] Integer number of repeated metadata description objects that need to be returned (if id is not specified).

Value

A character vector of Bulk API document information objects.

See Also

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html for more information on the information required by the Elasticsearch Bulk API.

Examples

1
2
3
4
5
6
## Not run: 
create_metadata("index", "iris", "data", n = 2)
'{\"index\": {\"_index\": \"iris\", \"_type\": \"data\"}}'
'{\"index\": {\"_index\": \"iris\", \"_type\": \"data\"}}'

## End(Not run)

elasticsearchr documentation built on July 31, 2019, 1:05 a.m.