elasticsearch

package
v1.146.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAliasMissing = errors.New("alias is missing")
View Source
var ErrOpTooLarge = errors.New("BulkOp exceeds maximum payload size")

Functions

This section is empty.

Types

type BulkOp

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

func NewBulkOp

func NewBulkOp(index string) *BulkOp

func (*BulkOp) Empty

func (op *BulkOp) Empty() bool

func (*BulkOp) Index

func (op *BulkOp) Index(id string, v interface{}) error

func (*BulkOp) Reset

func (op *BulkOp) Reset()

type BulkResult

type BulkResult struct {
	Successful int
	Failed     int
	Error      string
}

type Client

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

func NewClient

func NewClient(httpClient HTTPClient, logger *logrus.Logger) (*Client, error)

func (*Client) CreateAlias

func (c *Client) CreateAlias(ctx context.Context, alias, index string) error

func (*Client) CreateIndex

func (c *Client) CreateIndex(ctx context.Context, name string, config []byte, force bool) error

func (*Client) Delete added in v1.47.0

func (c *Client) Delete(ctx context.Context, indices []string, requestBody map[string]interface{}) (*DeleteResult, error)

func (*Client) DeleteIndex

func (c *Client) DeleteIndex(ctx context.Context, name string) error

func (*Client) DoBulk

func (c *Client) DoBulk(ctx context.Context, op *BulkOp) (BulkResult, error)

func (*Client) IndexExists

func (c *Client) IndexExists(ctx context.Context, name string) (bool, error)

func (*Client) Indices

func (c *Client) Indices(ctx context.Context, term string) ([]string, error)

func (*Client) ResolveAlias

func (c *Client) ResolveAlias(ctx context.Context, name string) (string, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, indices []string, requestBody map[string]interface{}) (*SearchResult, error)

returns an array of JSON encoded results

func (*Client) UpdateAlias

func (c *Client) UpdateAlias(ctx context.Context, alias, oldIndex, newIndex string) error

type DeleteResult added in v1.47.0

type DeleteResult struct {
	Total int
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type IndexResult

type IndexResult struct {
	Id         int64  `json:"id"`
	StatusCode int    `json:"statusCode"`
	Message    string `json:"message"`
}

type MockESClient

type MockESClient struct {
	mock.Mock
}

func (*MockESClient) CreateAlias

func (m *MockESClient) CreateAlias(ctx context.Context, alias string, index string) error

func (*MockESClient) CreateIndex

func (m *MockESClient) CreateIndex(ctx context.Context, name string, config []byte, force bool) error

func (*MockESClient) Delete added in v1.47.0

func (m *MockESClient) Delete(ctx context.Context, indexName []string, requestBody map[string]interface{}) (*DeleteResult, error)

func (*MockESClient) DoBulk

func (m *MockESClient) DoBulk(ctx context.Context, op *BulkOp) (BulkResult, error)

func (*MockESClient) ResolveAlias

func (m *MockESClient) ResolveAlias(ctx context.Context, alias string) (string, error)

func (*MockESClient) Search

func (m *MockESClient) Search(ctx context.Context, indexName []string, requestBody map[string]interface{}) (*SearchResult, error)

type SearchResult

type SearchResult struct {
	Hits         []json.RawMessage
	Aggregations map[string]map[string]int
	Total        int
	TotalExact   bool
}

Jump to

Keyboard shortcuts

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