elasticsearch

package
v1.19.20 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package elasticsearch provides a client for the Elasticsearch. Features: - Message's content by default is JSON-formatted. - Provides multiple ways to set the index name: static, or dynamic - which is evaluated at index time.

NOTE: It's the caller's responsibility to create the index, define its mapping, and settings.

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 a function which defines the name of the index, and evaluated at the index time.

type ElasticSearch

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

	// Config is the ElasticSearch configuration.
	Config Config

	// DynamicIndex is a function which defines the name of the index, and
	// evaluated at the index time.
	DynamicIndex DynamicIndexFunc
}

ElasticSearch `Output` definition.

func New

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

New returns a new `ElasticSearch` client.

func NewWithDynamicIndex added in v1.6.3

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

NewWithDynamicIndex returns a new `ElasticSearch` client. It allows to define is a function which defines the name of the index, and evaluated at the index time.

func (*ElasticSearch) Write

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

Write conforms to the `io.Writer` interface.

Jump to

Keyboard shortcuts

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