esbulk

package module
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2015 License: MIT Imports: 8 Imported by: 0

README

esbulk

Fast parallel bulk loading utility for elasticsearch. Asciicast.

Installation

$ go get github.com/miku/esbulk/cmd/esbulk

For deb or rpm packages, see: https://github.com/miku/esbulk/releases

Usage

$ esbulk -h
Usage: esbulk [OPTIONS] JSON
  -cpuprofile="": write cpu profile to file
  -host="localhost": elasticsearch host
  -index="": index name
  -memprofile="": write heap profile to file
  -port=9200: elasticsearch port
  -size=1000: bulk batch size
  -type="default": elasticsearch doc type
  -v=false: prints current program version
  -verbose=false: output basic progress
  -w=4: number of workers to use
  -z=false: unzip gz'd file on the fly

To index a JSON file, that contains one document per line, just run:

$ esbulk -index example file.ldj

Where file.ldj is line delimited JSON, like:

{"name": "esbulk", "version": "0.2.4"}
{"name": "estab", "version": "0.1.3"}
...

By default esbulk will use as many parallel workers, as there are cores. To tweak the indexing process, adjust the -size and -w parameters.

You can index from gzipped files as well, using the -z flag:

$ esbulk -z -index example file.ldj.gz

A similar project has been started for solr, called solrbulk.

Documentation

Index

Constants

View Source
const Version = "0.3.5"

Application Version

Variables

This section is empty.

Functions

func BulkIndex added in v0.3.0

func BulkIndex(docs []string, options Options) error

BulkIndex takes a set of documents as strings and indexes them into elasticsearch

func CreateIndex added in v0.3.5

func CreateIndex(options Options) error

CreateIndex creates a new index.

func DeleteIndex added in v0.3.5

func DeleteIndex(options Options) error

DeleteIndex removes an index.

func PutMapping added in v0.3.5

func PutMapping(options Options, body io.Reader) error

PutMapping reads and applies a mapping from a reader.

func Worker added in v0.3.0

func Worker(id string, options Options, lines chan string, wg *sync.WaitGroup)

Worker will batch index documents that come in on the lines channel

Types

type Options added in v0.3.0

type Options struct {
	Host      string
	Port      int
	Index     string
	DocType   string
	BatchSize int
	Verbose   bool
}

Options represents bulk indexing options

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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