Documentation ¶
Overview ¶
Package esbulk implements a few helpers for performant indexing operations for elasticsearch.
Index ¶
- Variables
- func BulkIndex(docs []string, options Options) error
- func CreateIndex(options Options, body io.Reader) error
- func DeleteIndex(options Options) error
- func FlushIndex(idx int, options Options) error
- func GetSettings(idx int, options Options) (map[string]interface{}, error)
- func PutMapping(options Options, body io.Reader) error
- func Worker(id string, options Options, lines chan string, wg *sync.WaitGroup)
- type ArrayFlags
- type BulkResponse
- type Item
- type Options
- type Runner
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BulkIndex ¶ added in v0.3.0
BulkIndex takes a set of documents as strings and indexes them into elasticsearch.
func CreateIndex ¶ added in v0.6.0
CreateIndex creates a new index.
func DeleteIndex ¶ added in v0.6.0
DeleteIndex removes an index.
func FlushIndex ¶ added in v0.6.0
FlushIndex flushes index.
func GetSettings ¶ added in v0.6.0
GetSettings fetches the settings of the index.
func PutMapping ¶ added in v0.6.0
PutMapping applies a mapping from a reader.
Types ¶
type ArrayFlags ¶ added in v0.6.0
type ArrayFlags []string
ArrayFlags allows to store lists of flag values.
func (*ArrayFlags) Set ¶ added in v0.6.0
func (f *ArrayFlags) Set(value string) error
Set appends a value.
func (*ArrayFlags) String ¶ added in v0.6.0
func (f *ArrayFlags) String() string
String representation.
type BulkResponse ¶ added in v0.6.0
type BulkResponse struct { Took int `json:"took"` HasErrors bool `json:"errors"` Items []Item `json:"items"` }
BulkResponse is a response to a bulk request.
type Item ¶ added in v0.6.0
type Item struct { IndexAction struct { Index string `json:"_index"` Type string `json:"_type"` ID string `json:"_id"` Status int `json:"status"` Error struct { Type string `json:"type"` Reason string `json:"reason"` IndexUUID string `json:"index_uuid"` Shard string `json:"shard"` Index string `json:"index"` } `json:"error"` } `json:"index"` }
Item represents a bulk action.
type Options ¶ added in v0.3.0
type Options struct { Servers []string Index string OpType string DocType string BatchSize int Verbose bool IDField string Scheme string // http or https; deprecated, use: Servers. Username string Password string Pipeline string IncludeTypeName bool // https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0 }
Options represents bulk indexing options.
type Runner ¶ added in v0.7.0
type Runner struct { BatchSize int Config string CpuProfile string OpType string DocType string File *os.File FileGzipped bool IdentifierField string IndexName string Mapping string MemProfile string NumWorkers int Password string Pipeline string Purge bool PurgePause time.Duration RefreshInterval string Scheme string Servers []string Settings string ShowVersion bool SkipBroken bool Username string Verbose bool ZeroReplica bool }
Runner bundles various options. Factored out of a former main func and should be further split up (TODO).