elasticsearch

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config = elasticsearch.Config

Config is the ElasticSearch configuration.

type DynamicIndexFunc added in v1.6.3

type DynamicIndexFunc func() string

DynamicIndexFunc is the name of the index to be used, evaluated at the insertion time.

type ElasticSearch

type ElasticSearch struct {
	// Client is the ElasticSearch client.
	Client *elasticsearch.Client

	// Config is the ElasticSearch configuration.
	Config Config

	// DynamicIndex is the name of the index to be used, evaluated at the
	// insertion time.
	//
	// NOTE: It's the caller's responsibility to create the index, define its
	// mapping, and settings.
	DynamicIndex DynamicIndexFunc
}

ElasticSearch `Output` definition.

func New

func New(
	indexName string,
	esConfig Config,
) *ElasticSearch

New is a built-in `output` - named `ElasticSearch`, that writes to ElasticSearch.

NOTE: By default, data is JSON-formatted. NOTE: `DocumentID` is automatically generated. NOTE: It's the caller's responsibility to create the index, define its mapping, and settings.

func NewWithDynamicIndex added in v1.6.3

func NewWithDynamicIndex(
	indexName DynamicIndexFunc,
	esConfig Config,
) *ElasticSearch

NewWithDynamicIndex is a built-in `output` - named `ElasticSearch`, that writes to ElasticSearch. It allows to define a function that returns the index name to be used, evaluated at the insertion time.

NOTE: By default, data is JSON-formatted. NOTE: `DocumentID` is automatically generated. NOTE: It's the caller's responsibility to create the index, define its mapping, and settings.

func (*ElasticSearch) Write

func (es *ElasticSearch) Write(data []byte) (int, error)

Write conforms to the `io.Writer` interface.

NOTE: By default, data is JSON-formatted. NOTE: `DocumentID` is automatically generated.

Jump to

Keyboard shortcuts

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