elasticsearch

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package elasticsearch is a generated GoMock package.

Package elasticsearch is a generated GoMock package.

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 BulkProcessor added in v1.6.0

type BulkProcessor interface {
	Stop() error
	Add(request *BulkableRequest)
}

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 BulkService added in v1.6.0

type BulkService interface {
	Do(ctx context.Context) error
	NumberOfActions() int
	Add(request *BulkableRequest)
}

type BulkableRequest added in v1.6.0

type BulkableRequest struct {
	RequestType BulkableRequestType
	Index       string
	ID          string
	Version     int64
	Doc         map[string]interface{}
}

type BulkableRequestType added in v1.6.0

type BulkableRequestType uint8
const (
	BulkableRequestTypeIndex BulkableRequestType = iota
	BulkableRequestTypeDelete
)

type CLIClient added in v1.6.0

type CLIClient interface {
	CatIndices(ctx context.Context) (elastic.CatIndicesResponse, error)
	SearchWithDSL(ctx context.Context, index, query string) (*elastic.SearchResult, error)
	Bulk() BulkService
}

func NewCLIClient added in v1.6.0

func NewCLIClient(url string, version string) (CLIClient, error)

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) (BulkProcessor, error)
	PutMapping(ctx context.Context, index, root, key, valueType 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, logger log.Logger) (Client, error)

type Config

type Config struct {
	Version           string                  `yaml:"version"`
	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 IntegrationTestsClient added in v1.6.0

type IntegrationTestsClient interface {
	CreateIndex(ctx context.Context, index string) (bool, error)
	IndexPutTemplate(ctx context.Context, templateName string, bodyString string) (bool, error)
	IndexExists(ctx context.Context, indexName string) (bool, error)
	DeleteIndex(ctx context.Context, indexName string) (bool, error)
	IndexPutSettings(ctx context.Context, indexName string, bodyString string) (bool, error)
	IndexGetSettings(ctx context.Context, indexName string) (map[string]*elastic.IndicesGetSettingsResponse, error)
}

func NewIntegrationTestsClient added in v1.6.0

func NewIntegrationTestsClient(url string, version string) (IntegrationTestsClient, error)

type MockBulkProcessor added in v1.6.0

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

MockBulkProcessor is a mock of BulkProcessor interface.

func NewMockBulkProcessor added in v1.6.0

func NewMockBulkProcessor(ctrl *gomock.Controller) *MockBulkProcessor

NewMockBulkProcessor creates a new mock instance.

func (*MockBulkProcessor) Add added in v1.6.0

func (m *MockBulkProcessor) Add(request *BulkableRequest)

Add mocks base method.

func (*MockBulkProcessor) EXPECT added in v1.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBulkProcessor) Stop added in v1.6.0

func (m *MockBulkProcessor) Stop() error

Stop mocks base method.

type MockBulkProcessorMockRecorder added in v1.6.0

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

MockBulkProcessorMockRecorder is the mock recorder for MockBulkProcessor.

func (*MockBulkProcessorMockRecorder) Add added in v1.6.0

func (mr *MockBulkProcessorMockRecorder) Add(request interface{}) *gomock.Call

Add indicates an expected call of Add.

func (*MockBulkProcessorMockRecorder) Stop added in v1.6.0

Stop indicates an expected call of Stop.

type MockCLIClient added in v1.6.0

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

MockCLIClient is a mock of CLIClient interface.

func NewMockCLIClient added in v1.6.0

func NewMockCLIClient(ctrl *gomock.Controller) *MockCLIClient

NewMockCLIClient creates a new mock instance.

func (*MockCLIClient) Bulk added in v1.6.0

func (m *MockCLIClient) Bulk() BulkService

Bulk mocks base method.

func (*MockCLIClient) CatIndices added in v1.6.0

func (m *MockCLIClient) CatIndices(ctx context.Context) (v7.CatIndicesResponse, error)

CatIndices mocks base method.

func (*MockCLIClient) EXPECT added in v1.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCLIClient) SearchWithDSL added in v1.6.0

func (m *MockCLIClient) SearchWithDSL(ctx context.Context, index, query string) (*v7.SearchResult, error)

SearchWithDSL mocks base method.

type MockCLIClientMockRecorder added in v1.6.0

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

MockCLIClientMockRecorder is the mock recorder for MockCLIClient.

func (*MockCLIClientMockRecorder) Bulk added in v1.6.0

Bulk indicates an expected call of Bulk.

func (*MockCLIClientMockRecorder) CatIndices added in v1.6.0

func (mr *MockCLIClientMockRecorder) CatIndices(ctx interface{}) *gomock.Call

CatIndices indicates an expected call of CatIndices.

func (*MockCLIClientMockRecorder) SearchWithDSL added in v1.6.0

func (mr *MockCLIClientMockRecorder) SearchWithDSL(ctx, index, query interface{}) *gomock.Call

SearchWithDSL indicates an expected call of SearchWithDSL.

type MockClient added in v1.6.0

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

MockClient is a mock of Client interface.

func NewMockClient added in v1.6.0

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) Count added in v1.6.0

func (m *MockClient) Count(ctx context.Context, index, query string) (int64, error)

Count mocks base method.

func (*MockClient) EXPECT added in v1.6.0

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) PutMapping added in v1.6.0

func (m *MockClient) PutMapping(ctx context.Context, index, root, key, valueType string) error

PutMapping mocks base method.

func (*MockClient) RunBulkProcessor added in v1.6.0

func (m *MockClient) RunBulkProcessor(ctx context.Context, p *BulkProcessorParameters) (BulkProcessor, error)

RunBulkProcessor mocks base method.

func (*MockClient) Scroll added in v1.6.0

func (m *MockClient) Scroll(ctx context.Context, scrollID string) (*v7.SearchResult, ScrollService, error)

Scroll mocks base method.

func (*MockClient) ScrollFirstPage added in v1.6.0

func (m *MockClient) ScrollFirstPage(ctx context.Context, index, query string) (*v7.SearchResult, ScrollService, error)

ScrollFirstPage mocks base method.

func (*MockClient) Search added in v1.6.0

Search mocks base method.

func (*MockClient) SearchWithDSL added in v1.6.0

func (m *MockClient) SearchWithDSL(ctx context.Context, index, query string) (*v7.SearchResult, error)

SearchWithDSL mocks base method.

type MockClientMockRecorder added in v1.6.0

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Count added in v1.6.0

func (mr *MockClientMockRecorder) Count(ctx, index, query interface{}) *gomock.Call

Count indicates an expected call of Count.

func (*MockClientMockRecorder) PutMapping added in v1.6.0

func (mr *MockClientMockRecorder) PutMapping(ctx, index, root, key, valueType interface{}) *gomock.Call

PutMapping indicates an expected call of PutMapping.

func (*MockClientMockRecorder) RunBulkProcessor added in v1.6.0

func (mr *MockClientMockRecorder) RunBulkProcessor(ctx, p interface{}) *gomock.Call

RunBulkProcessor indicates an expected call of RunBulkProcessor.

func (*MockClientMockRecorder) Scroll added in v1.6.0

func (mr *MockClientMockRecorder) Scroll(ctx, scrollID interface{}) *gomock.Call

Scroll indicates an expected call of Scroll.

func (*MockClientMockRecorder) ScrollFirstPage added in v1.6.0

func (mr *MockClientMockRecorder) ScrollFirstPage(ctx, index, query interface{}) *gomock.Call

ScrollFirstPage indicates an expected call of ScrollFirstPage.

func (*MockClientMockRecorder) Search added in v1.6.0

func (mr *MockClientMockRecorder) Search(ctx, p interface{}) *gomock.Call

Search indicates an expected call of Search.

func (*MockClientMockRecorder) SearchWithDSL added in v1.6.0

func (mr *MockClientMockRecorder) SearchWithDSL(ctx, index, query interface{}) *gomock.Call

SearchWithDSL indicates an expected call of SearchWithDSL.

type MockIntegrationTestsClient added in v1.6.0

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

MockIntegrationTestsClient is a mock of IntegrationTestsClient interface.

func NewMockIntegrationTestsClient added in v1.6.0

func NewMockIntegrationTestsClient(ctrl *gomock.Controller) *MockIntegrationTestsClient

NewMockIntegrationTestsClient creates a new mock instance.

func (*MockIntegrationTestsClient) CreateIndex added in v1.6.0

func (m *MockIntegrationTestsClient) CreateIndex(ctx context.Context, index string) (bool, error)

CreateIndex mocks base method.

func (*MockIntegrationTestsClient) DeleteIndex added in v1.6.0

func (m *MockIntegrationTestsClient) DeleteIndex(ctx context.Context, indexName string) (bool, error)

DeleteIndex mocks base method.

func (*MockIntegrationTestsClient) EXPECT added in v1.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIntegrationTestsClient) IndexExists added in v1.6.0

func (m *MockIntegrationTestsClient) IndexExists(ctx context.Context, indexName string) (bool, error)

IndexExists mocks base method.

func (*MockIntegrationTestsClient) IndexGetSettings added in v1.6.0

func (m *MockIntegrationTestsClient) IndexGetSettings(ctx context.Context, indexName string) (map[string]*v7.IndicesGetSettingsResponse, error)

IndexGetSettings mocks base method.

func (*MockIntegrationTestsClient) IndexPutSettings added in v1.6.0

func (m *MockIntegrationTestsClient) IndexPutSettings(ctx context.Context, indexName, bodyString string) (bool, error)

IndexPutSettings mocks base method.

func (*MockIntegrationTestsClient) IndexPutTemplate added in v1.6.0

func (m *MockIntegrationTestsClient) IndexPutTemplate(ctx context.Context, templateName, bodyString string) (bool, error)

IndexPutTemplate mocks base method.

type MockIntegrationTestsClientMockRecorder added in v1.6.0

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

MockIntegrationTestsClientMockRecorder is the mock recorder for MockIntegrationTestsClient.

func (*MockIntegrationTestsClientMockRecorder) CreateIndex added in v1.6.0

func (mr *MockIntegrationTestsClientMockRecorder) CreateIndex(ctx, index interface{}) *gomock.Call

CreateIndex indicates an expected call of CreateIndex.

func (*MockIntegrationTestsClientMockRecorder) DeleteIndex added in v1.6.0

func (mr *MockIntegrationTestsClientMockRecorder) DeleteIndex(ctx, indexName interface{}) *gomock.Call

DeleteIndex indicates an expected call of DeleteIndex.

func (*MockIntegrationTestsClientMockRecorder) IndexExists added in v1.6.0

func (mr *MockIntegrationTestsClientMockRecorder) IndexExists(ctx, indexName interface{}) *gomock.Call

IndexExists indicates an expected call of IndexExists.

func (*MockIntegrationTestsClientMockRecorder) IndexGetSettings added in v1.6.0

func (mr *MockIntegrationTestsClientMockRecorder) IndexGetSettings(ctx, indexName interface{}) *gomock.Call

IndexGetSettings indicates an expected call of IndexGetSettings.

func (*MockIntegrationTestsClientMockRecorder) IndexPutSettings added in v1.6.0

func (mr *MockIntegrationTestsClientMockRecorder) IndexPutSettings(ctx, indexName, bodyString interface{}) *gomock.Call

IndexPutSettings indicates an expected call of IndexPutSettings.

func (*MockIntegrationTestsClientMockRecorder) IndexPutTemplate added in v1.6.0

func (mr *MockIntegrationTestsClientMockRecorder) IndexPutTemplate(ctx, templateName, bodyString interface{}) *gomock.Call

IndexPutTemplate indicates an expected call of IndexPutTemplate.

type MockScrollService added in v1.6.0

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

MockScrollService is a mock of ScrollService interface.

func NewMockScrollService added in v1.6.0

func NewMockScrollService(ctrl *gomock.Controller) *MockScrollService

NewMockScrollService creates a new mock instance.

func (*MockScrollService) Clear added in v1.6.0

func (m *MockScrollService) Clear(ctx context.Context) error

Clear mocks base method.

func (*MockScrollService) EXPECT added in v1.6.0

EXPECT returns an object that allows the caller to indicate expected use.

type MockScrollServiceMockRecorder added in v1.6.0

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

MockScrollServiceMockRecorder is the mock recorder for MockScrollService.

func (*MockScrollServiceMockRecorder) Clear added in v1.6.0

func (mr *MockScrollServiceMockRecorder) Clear(ctx interface{}) *gomock.Call

Clear indicates an expected call of Clear.

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

Jump to

Keyboard shortcuts

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