elasticsearch

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NamespaceID     = "NamespaceId"
	WorkflowID      = "WorkflowId"
	RunID           = "RunId"
	WorkflowType    = "WorkflowType"
	StartTime       = "StartTime"
	ExecutionTime   = "ExecutionTime"
	CloseTime       = "CloseTime"
	ExecutionStatus = "ExecutionStatus"
	HistoryLength   = "HistoryLength"
	Memo            = "Memo"
	Encoding        = "Encoding"
	TaskQueue       = "TaskQueue"
	CustomNamespace = "CustomNamespace"

	KafkaKey = "KafkaKey"
)

All legal fields allowed in elastic search index

Variables

View Source
var (
	FieldTypeString = enumsspb.FIELD_TYPE_STRING
	FieldTypeInt    = enumsspb.FIELD_TYPE_INT
	FieldTypeBool   = enumsspb.FIELD_TYPE_BOOL
	FieldTypeBinary = enumsspb.FIELD_TYPE_BINARY
)

Supported field types

Functions

This section is empty.

Types

type AWSRequestSigningConfig added in v1.4.0

type AWSRequestSigningConfig struct {
	Enabled bool   `yaml:"enabled"`
	Region  string `yaml:"region"`

	// Possible options for CredentialProvider include:
	//   1) static (fill out static Credential Provider)
	//   2) environment
	//		a) AccessKeyID from either AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY environment variable
	//		b) SecretAccessKey from either AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY environment variable
	//   3) aws-sdk-default
	//		a) Follows aws-go-sdk default credential resolution for session.NewSession
	CredentialProvider string `yaml:"credentialProvider"`

	Static AWSStaticCredentialProvider `yaml:"static"`
}

AWSRequestSigningConfig represents configuration for signing ES requests to AWS

type AWSStaticCredentialProvider added in v1.4.0

type AWSStaticCredentialProvider struct {
	AccessKeyID     string `yaml:"accessKeyID"`
	SecretAccessKey string `yaml:"secretAccessKey"`

	// Token only required for temporary security credentials retrieved via STS. Otherwise, this is optional.
	Token string `yaml:"token"`
}

AWSStaticCredentialProvider represents static AWS credentials

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)
	Scroll(ctx context.Context, scrollID string) (*elastic.SearchResult, ScrollService, error)
	ScrollFirstPage(ctx context.Context, index, query string) (*elastic.SearchResult, ScrollService, error)
	Count(ctx context.Context, index, query string) (int64, error)
	RunBulkProcessor(ctx context.Context, p *BulkProcessorParameters) (*elastic.BulkProcessor, error)
	PutMapping(ctx context.Context, index, root, key, valueType string) error
	CreateIndex(ctx context.Context, index string) 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 {
	URL               url.URL                 `yaml:"url"` //nolint:govet
	Username          string                  `yaml:"username"`
	Password          string                  `yaml:"password"`
	Indices           map[string]string       `yaml:"indices"` //nolint:govet
	AWSRequestSigning AWSRequestSigningConfig `yaml:"aws-request-signing"`
}

Config for connecting to ElasticSearch

func (*Config) GetVisibilityIndex added in v0.6.0

func (cfg *Config) GetVisibilityIndex() string

GetVisibilityIndex return visibility index name

type ScrollService added in v0.5.8

type ScrollService interface {
	Clear(ctx context.Context) error
}

ScrollService is a interface for elastic.ScrollService

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