elasticsearch

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "elasticsearch"

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkIndexerResponse added in v1.5.0

type BulkIndexerResponse struct {
	Took      int                                   `json:"took"`
	HasErrors bool                                  `json:"errors"`
	Items     []map[string]*BulkIndexerResponseItem `json:"items,omitempty"`
}

BulkIndexerResponse represents the Elasticsearch response.

func (*BulkIndexerResponse) Failed added in v1.5.0

type BulkIndexerResponseItem added in v1.5.0

type BulkIndexerResponseItem struct {
	Index      string `json:"_index"`
	DocumentID string `json:"_id"`
	Version    int64  `json:"_version"`
	Result     string `json:"result"`
	Status     int    `json:"status"`
	SeqNo      int64  `json:"_seq_no"`
	PrimTerm   int64  `json:"_primary_term"`

	Shards struct {
		Total      int `json:"total"`
		Successful int `json:"successful"`
		Failed     int `json:"failed"`
	} `json:"_shards"`

	Error struct {
		Type   string `json:"type"`
		Reason string `json:"reason"`
		Cause  struct {
			Type   string `json:"type"`
			Reason string `json:"reason"`
		} `json:"caused_by"`
	} `json:"error,omitempty"`
}

BulkIndexerResponseItem represents the Elasticsearch response item.

type Client

type Client interface {
	Bulk(ctx context.Context, batch api.Batch) error
	Stop()
}

type ClientSet

type ClientSet struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config, cod codec.Codec, indexPattern *pattern.Pattern, documentIdPattern *pattern.Pattern,
	defaultIndexPattern *pattern.Pattern) (*ClientSet, error)

func (*ClientSet) Bulk added in v1.5.0

func (c *ClientSet) Bulk(ctx context.Context, batch api.Batch) error

func (*ClientSet) Stop

func (c *ClientSet) Stop()

type Config

type Config struct {
	Hosts                 []string          `yaml:"hosts,omitempty" validate:"required"`
	UserName              string            `yaml:"username,omitempty"`
	Password              string            `yaml:"password,omitempty"`
	Index                 string            `yaml:"index,omitempty"`
	Headers               map[string]string `yaml:"headers,omitempty"`
	Params                map[string]string `yaml:"parameters,omitempty"`
	IfRenderIndexFailed   RenderIndexFail   `yaml:"ifRenderIndexFailed,omitempty"`
	Etype                 string            `yaml:"etype,omitempty"` // elasticsearch type, for v5.* backward compatibility
	DocumentId            string            `yaml:"documentId,omitempty"`
	APIKey                string            `yaml:"apiKey,omitempty"`
	ServiceToken          string            `yaml:"serviceToken,omitempty"`
	CACertPath            string            `yaml:"caCertPath,omitempty"`
	Compress              bool              `yaml:"compress,omitempty"`
	Gzip                  *bool             `yaml:"gzip,omitempty"` // deprecated, use compress above
	OpType                string            `yaml:"opType,omitempty" default:"index"`
	DiscoverNodesOnStart  bool              `yaml:"discoverNodesOnStart,omitempty"`
	DiscoverNodesInterval time.Duration     `yaml:"discoverNodesInterval,omitempty"`
}

func (*Config) Validate added in v1.1.0

func (c *Config) Validate() error

type RenderIndexFail added in v1.5.0

type RenderIndexFail struct {
	DropEvent    bool   `yaml:"dropEvent,omitempty" default:"true"`
	IgnoreError  bool   `yaml:"ignoreError,omitempty"`
	DefaultIndex string `yaml:"defaultIndex,omitempty"`
}

type Sink

type Sink struct {
	// contains filtered or unexported fields
}

func NewSink

func NewSink() *Sink

func (*Sink) Category

func (s *Sink) Category() api.Category

func (*Sink) Config

func (s *Sink) Config() interface{}

func (*Sink) Consume

func (s *Sink) Consume(batch api.Batch) api.Result

func (*Sink) Init

func (s *Sink) Init(context api.Context) error

func (*Sink) SetCodec

func (s *Sink) SetCodec(c codec.Codec)

func (*Sink) Start

func (s *Sink) Start() error

func (*Sink) Stop

func (s *Sink) Stop()

func (*Sink) String

func (s *Sink) String() string

func (*Sink) Type

func (s *Sink) Type() api.Type

Jump to

Keyboard shortcuts

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