bulk_insert

command
v5.0.64+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

BulkInsert illustrates how to bulk insert documents into Elasticsearch.

It uses two goroutines to do so. The first creates a simple document and sends it to the second via a channel. The second goroutine collects those documents, creates a bulk request that is added to a Bulk service and committed to Elasticsearch after reaching a number of documents. The number of documents after which a commit happens can be specified via the "bulk-size" flag.

See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html for details on the Bulk API in Elasticsearch.

Example

Bulk index 100.000 documents into the index "warehouse", type "product", committing every set of 1.000 documents.

bulk_insert -index=warehouse -type=product -n=100000 -bulk-size=1000

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL