Learn R Programming

elasticsearchr (version 0.3.1)

create_bulk_upload_file: Create Bulk API data file.

Description

The fastest way to index, delete or update many documents, is via the Bulk API. This function assembles a text file comprising of data and/or actions in the format required by the Bulk API. This is ready to be POSTed to the Bulk API.

Usage

create_bulk_upload_file(metadata, df = NULL)

create_bulk_delete_file(metadata)

Arguments

metadata

A character vector of Bulk API document information objects, as generated by create_metadata(...).

df

[optional] A data.frame with data for indexing or updating.

Value

The name of the temporary file containing the data for the Elasticsearch Bulk API.

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

Run this code
# NOT RUN {
bulk_upload_info <- create_metadata("index", "iris", "data", n = nrow(iris))
create_bulk_upload_file(bulk_upload_info, iris)
# "/var/folders/__/yz_l30s48xj6m_0059b_2twr0000gn/T//RtmpQnvUOt/file98194322b8"

bulk_delete_info <- create_metadata("delete", "iris", "data", n = nrow(iris))
create_bulk_delete_file(bulk_delete_info)
# "/var/folders/__/yz_l30s48xj6m_0059b_2twr0000gn/T//RtmpQnvUOt/file98194322b8"
# }

Run the code above in your browser using DataLab