elasticsearch

package
v1.2.14-prerelease08 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 25 Imported by: 9

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"
	TaskList            = "TaskList"
	IsCron              = "IsCron"
	NumClusters         = "NumClusters"
	VisibilityOperation = "VisibilityOperation"
	UpdateTime          = "UpdateTime"
	ShardID             = "ShardID"
)

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 GenerateDocID added in v0.24.0

func GenerateDocID(wid, rid string) string

func GetESDocDelimiter added in v0.24.0

func GetESDocDelimiter() string

func GetESDocIDSizeLimit added in v0.24.0

func GetESDocIDSizeLimit() int

func GetESDocType added in v0.24.0

func GetESDocType() string

func SerializePageToken added in v0.17.0

func SerializePageToken(token *ElasticVisibilityPageToken) ([]byte, error)

SerializePageToken return the token blob

func ShouldSearchAfter added in v0.17.0

func ShouldSearchAfter(token *ElasticVisibilityPageToken) bool

ShouldSearchAfter decides if should search after

Types

type ESClient added in v1.2.1

type ESClient struct {
	Client client.Client
	Logger log.Logger
}

func NewGenericClient added in v0.17.0

func NewGenericClient(
	connectConfig *config.ElasticSearchConfig,
	logger log.Logger,
) (*ESClient, error)

NewGenericClient create a ES client

func (*ESClient) CountByQuery added in v1.2.1

func (c *ESClient) CountByQuery(ctx context.Context, index, query string) (int64, error)

func (*ESClient) CreateIndex added in v1.2.1

func (c *ESClient) CreateIndex(ctx context.Context, index string) error

func (*ESClient) IsNotFoundError added in v1.2.1

func (c *ESClient) IsNotFoundError(err error) bool

func (*ESClient) PutMapping added in v1.2.1

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

func (*ESClient) RunBulkProcessor added in v1.2.1

func (*ESClient) ScanByQuery added in v1.2.1

func (c *ESClient) ScanByQuery(ctx context.Context, request *ScanByQueryRequest) (*SearchResponse, error)

func (*ESClient) Search added in v1.2.1

func (c *ESClient) Search(ctx context.Context, request *SearchRequest) (*SearchResponse, error)

func (*ESClient) SearchByQuery added in v1.2.1

func (c *ESClient) SearchByQuery(ctx context.Context, request *SearchByQueryRequest) (*SearchResponse, error)

func (*ESClient) SearchForOneClosedExecution added in v1.2.1

func (c *ESClient) SearchForOneClosedExecution(ctx context.Context, index string, request *SearchForOneClosedExecutionRequest) (*SearchForOneClosedExecutionResponse, error)

func (*ESClient) SearchRaw added in v1.2.1

func (c *ESClient) SearchRaw(ctx context.Context, index, query string) (*RawResponse, error)

type ElasticVisibilityPageToken added in v0.17.0

type ElasticVisibilityPageToken struct {
	// for ES API From+Size
	From int
	// for ES API searchAfter
	SortValue  interface{}
	TieBreaker string // runID
	// for ES scroll API
	ScrollID string
}

ElasticVisibilityPageToken holds the paging token for ElasticSearch

func DeserializePageToken added in v0.17.0

func DeserializePageToken(data []byte) (*ElasticVisibilityPageToken, error)

DeserializePageToken return the structural token

func GetNextPageToken added in v0.17.0

func GetNextPageToken(token []byte) (*ElasticVisibilityPageToken, error)

GetNextPageToken returns the structural token with nil handling

type GenericClient added in v0.17.0

type GenericClient interface {
	// Search API is only for supporting various List[Open/Closed]WorkflowExecutions(ByXyz).
	// Use SearchByQuery or ScanByQuery for generic purpose searching.
	Search(ctx context.Context, request *SearchRequest) (*SearchResponse, error)
	// SearchByQuery is the generic purpose searching
	SearchByQuery(ctx context.Context, request *SearchByQueryRequest) (*SearchResponse, error)
	// SearchRaw is for searching with raw json. Returns RawResult object which is subset of ESv6 and ESv7 response
	SearchRaw(ctx context.Context, index, query string) (*RawResponse, error)
	// ScanByQuery is also generic purpose searching, but implemented with ScrollService of ElasticSearch,
	// which is more performant for pagination, but comes with some limitation of in-parallel requests.
	ScanByQuery(ctx context.Context, request *ScanByQueryRequest) (*SearchResponse, error)
	// TODO remove it in https://github.com/uber/cadence/issues/3682
	SearchForOneClosedExecution(ctx context.Context, index string, request *SearchForOneClosedExecutionRequest) (*SearchForOneClosedExecutionResponse, error)
	// CountByQuery is for returning the count of workflow executions that match the query
	CountByQuery(ctx context.Context, index, query string) (int64, error)

	// RunBulkProcessor returns a processor for adding/removing docs into ElasticSearch index
	RunBulkProcessor(ctx context.Context, p *bulk.BulkProcessorParameters) (bulk.GenericBulkProcessor, error)

	// PutMapping adds new field type to the index
	PutMapping(ctx context.Context, index, root, key, valueType string) error
	// CreateIndex creates a new index
	CreateIndex(ctx context.Context, index string) error

	IsNotFoundError(err error) bool
}

GenericClient is a generic interface for all versions of ElasticSearch clients

type IsRecordValidFilter added in v0.17.0

type IsRecordValidFilter func(rec *p.InternalVisibilityWorkflowExecutionInfo) bool

IsRecordValidFilter is a function to filter visibility records

type RawResponse added in v0.24.0

type RawResponse struct {
	TookInMillis int64
	Hits         SearchHits
	Aggregations map[string]json.RawMessage
}

type ScanByQueryRequest added in v0.17.0

type ScanByQueryRequest struct {
	Index         string
	Query         string
	NextPageToken []byte
	PageSize      int
}

ScanByQueryRequest is request for SearchByQuery

type SearchByQueryRequest added in v0.17.0

type SearchByQueryRequest struct {
	Index           string
	Query           string
	NextPageToken   []byte
	PageSize        int
	Filter          IsRecordValidFilter
	MaxResultWindow int
}

SearchByQueryRequest is request for SearchByQuery

type SearchForOneClosedExecutionRequest added in v0.17.0

type SearchForOneClosedExecutionRequest = p.InternalGetClosedWorkflowExecutionRequest

SearchForOneClosedExecutionRequest is request for SearchForOneClosedExecution

type SearchForOneClosedExecutionResponse added in v0.17.0

type SearchForOneClosedExecutionResponse = p.InternalGetClosedWorkflowExecutionResponse

SearchForOneClosedExecutionResponse is response for SearchForOneClosedExecution

type SearchHits added in v0.24.0

type SearchHits struct {
	TotalHits int64
	Hits      []*p.InternalVisibilityWorkflowExecutionInfo
}

type SearchRequest added in v0.17.0

type SearchRequest struct {
	Index           string
	ListRequest     *p.InternalListWorkflowExecutionsRequest
	IsOpen          bool
	Filter          IsRecordValidFilter
	MatchQuery      *query.MatchQuery
	MaxResultWindow int
}

SearchRequest is request for Search

type SearchResponse added in v0.17.0

SearchResponse is a response to Search, SearchByQuery and ScanByQuery

type VisibilityRecord added in v0.17.0

type VisibilityRecord struct {
	WorkflowID    string
	RunID         string
	WorkflowType  string
	DomainID      string
	StartTime     int64
	ExecutionTime int64
	CloseTime     int64
	CloseStatus   workflow.WorkflowExecutionCloseStatus
	HistoryLength int64
	Memo          []byte
	Encoding      string
	TaskList      string
	IsCron        bool
	NumClusters   int16
	UpdateTime    int64
	Attr          map[string]interface{}
}

VisibilityRecord is a struct of doc for deserialization

Directories

Path Synopsis
os2
v6
v7

Jump to

Keyboard shortcuts

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