elastic

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggs

func Aggs(s *elastic.SearchService, params ...*AggsParam) *elastic.SearchService

Aggs 聚合搜索

Types

type AggsParam

type AggsParam struct {
	Field string
	Size  int
}

AggsParam 聚合搜索条件

type BulkDoc

type BulkDoc struct {
	ID  string
	Doc interface{}
}

BulkDoc es doc

type Client

type Client struct {
	*elastic.Client
}

Client elasticsearch客户端

func GetClient

func GetClient() *Client

GetClient get elasticsearch connection

func (*Client) BulkInsert

func (c *Client) BulkInsert(ctx context.Context, bds []*BulkDoc, indexName string, bulkNum, workerNum int) []error

BulkInsert 多worker按一定数量批量导入es

func (*Client) CreateIndex

func (c *Client) CreateIndex(ctx context.Context, indexName, mapping string) error

CreateIndex 创建es索引

func (*Client) FindIndexesByAlias

func (c *Client) FindIndexesByAlias(ctx context.Context, aliasName, layout string) []string

FindIndexesByAlias 获取别名相关有序索引名

func (*Client) GetNewIndexName

func (c *Client) GetNewIndexName(aliasName, layout string, nowTime ...time.Time) string

GetNewIndexName 获取新索引名

func (*Client) GetOldIndexNames

func (c *Client) GetOldIndexNames(ctx context.Context, aliasName string) []string

GetOldIndexNames 获取旧索引名

func (*Client) KeepIndex

func (c *Client) KeepIndex(ctx context.Context, indexNames []string, max int) error

KeepIndex 保留最新的几个索引

func (*Client) SetNewAlias

func (c *Client) SetNewAlias(ctx context.Context, aliasName, newIndexName string) error

SetNewAlias 设置新的别名

Jump to

Keyboard shortcuts

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