elasticsearch

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DomainID      = "DomainID"
	WorkflowID    = "WorkflowID"
	RunID         = "RunID"
	WorkflowType  = "WorkflowType"
	StartTime     = "StartTime"
	ExecutionTime = "ExecutionTime"
	CloseTime     = "CloseTime"
	CloseStatus   = "CloseStatus"
	HistoryLength = "HistoryLength"
	Memo          = "Memo"
	Encoding      = "Encoding"

	KafkaKey = "KafkaKey"
)

All legal fields allowed in elastic search index

Variables

View Source
var (
	FieldTypeString = indexer.FieldTypeString
	FieldTypeInt    = indexer.FieldTypeInt
	FieldTypeBool   = indexer.FieldTypeBool
	FieldTypeBinary = indexer.FieldTypeBinary
)

Supported field types

Functions

func IsFieldNameValid

func IsFieldNameValid(name string) bool

IsFieldNameValid return true if given field name are allowed to index in elastic search

Types

type BulkProcessorParameters

type BulkProcessorParameters struct {
	Name          string
	NumOfWorkers  int
	BulkActions   int
	BulkSize      int
	FlushInterval time.Duration
	Backoff       elastic.Backoff
	BeforeFunc    elastic.BulkBeforeFunc
	AfterFunc     elastic.BulkAfterFunc
}

BulkProcessorParameters holds all required and optional parameters for executing bulk service

type Client

type Client interface {
	Search(ctx context.Context, p *SearchParameters) (*elastic.SearchResult, error)
	SearchWithDSL(ctx context.Context, index, query string) (*elastic.SearchResult, error)
	RunBulkProcessor(ctx context.Context, p *BulkProcessorParameters) (*elastic.BulkProcessor, error)
}

Client is a wrapper around ElasticSearch client library. It simplifies the interface and enables mocking. We intentionally let implementation details of the elastic library bleed through, as the main purpose is testability not abstraction.

func NewClient

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

NewClient create a ES client

func NewWrapperClient

func NewWrapperClient(esClient *elastic.Client) Client

NewWrapperClient returns a new implementation of Client

type Config

type Config struct {
	Enable  bool              `yaml:enable`
	URL     url.URL           `yaml:url`
	Indices map[string]string `yaml:indices`
}

Config for connecting to ElasticSearch

type SearchParameters

type SearchParameters struct {
	Index       string
	Query       elastic.Query
	From        int
	PageSize    int
	Sorter      []elastic.Sorter
	SearchAfter []interface{}
}

SearchParameters holds all required and optional parameters for executing a search

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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