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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "elasticsearch"

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientSet

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

func NewClient

func NewClient(config *Config) (*ClientSet, error)

func (*ClientSet) Search

func (c *ClientSet) Search(ctx context.Context) ([][]byte, error)

func (*ClientSet) Stop

func (c *ClientSet) Stop()

type Config

type Config struct {
	PipelineName  string
	Name          string
	Hosts         []string `yaml:"hosts,omitempty" validate:"required"`
	UserName      string   `yaml:"username,omitempty"`
	Password      string   `yaml:"password,omitempty"`
	Schema        string   `yaml:"schema,omitempty"`
	Sniff         *bool    `yaml:"sniff,omitempty"`
	Gzip          *bool    `yaml:"gzip,omitempty"`
	IncludeFields []string `yaml:"includeFields,omitempty"`
	ExcludeFields []string `yaml:"excludeFields,omitempty"`
	Query         string   `yaml:"query,omitempty"`
	SortBy        []SortBy `yaml:"sortBy,omitempty" validate:"required"`
	Indices       []string `yaml:"indices,omitempty" validate:"required"`
	Size          int      `yaml:"size,omitempty" default:"100"`

	Interval time.Duration `yaml:"interval,omitempty" default:"30s"`
	Timeout  time.Duration `yaml:"timeout,omitempty" default:"5s"`

	DBConfig DBConfig `yaml:"db,omitempty"`
}

func (*Config) AllSortByFields added in v1.5.0

func (c *Config) AllSortByFields() []string

func (*Config) Validate

func (c *Config) Validate() error

type DB

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

func NewDB

func NewDB(index string, es *elastic.Client) *DB

func (*DB) Remove

func (p *DB) Remove(ctx context.Context) (err error)

func (*DB) Search

func (p *DB) Search(ctx context.Context) (*Offset, error)

func (*DB) Upsert

func (p *DB) Upsert(ctx context.Context, ost *Offset, sortKeys []string) error

type DBConfig

type DBConfig struct {
	IndexPrefix          string        `yaml:"indexPrefix,omitempty" default:".loggie-db"`
	FlushTimeout         time.Duration `yaml:"flushTimeout,omitempty" default:"2s"`
	CleanInactiveTimeout time.Duration `yaml:"cleanInactiveTimeout,omitempty" default:"504h"` // default records not updated in 21 days will be deleted
	CleanScanInterval    time.Duration `yaml:"cleanScanInterval,omitempty" default:"1h"`
}

type Offset

type Offset struct {
	Sort      []interface{}          `json:"-"`
	Body      map[string]interface{} `json:"sorts"`
	CreatedAt time.Time              `json:"created_at"`
}

type SortBy added in v1.5.0

type SortBy struct {
	Fields    string `yaml:"fields,omitempty"`
	Ascending bool   `yaml:"ascending,omitempty" default:"true"`
}

type Source

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

func (*Source) Category

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

func (*Source) Commit

func (s *Source) Commit(events []api.Event)

func (*Source) Config

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

func (*Source) Init

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

func (*Source) ProductLoop

func (s *Source) ProductLoop(productFunc api.ProductFunc)

func (*Source) Start

func (s *Source) Start() error

func (*Source) Stop

func (s *Source) Stop()

func (*Source) String

func (s *Source) String() string

func (*Source) Type

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

Jump to

Keyboard shortcuts

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