Documentation
¶
Overview ¶
Package es Date: 2023/3/24 18:00 Author: Amu Description:
Package es Date: 2023/12/1 15:43 Author: Amu Description:
Package es Date: 2023/3/24 14:30 Author: Amu Description:
Package es Date: 2023/12/1 15:51 Author: Amu Description:
Package es Date: 2023/4/20 17:03 Author: Amu Description:
Package es Date: 2023/3/27 15:50 Author: Amu Description:
Package es Date: 2023/3/30 15:12 Author: Amu Description:
Package es Date: 2023/3/27 19:14 Author: Amu Description: 索引声明周期管理策略
Package es Date: 2023/3/30 12:07 Author: Amu Description: client crud
Package es Date: 2023/12/1 16:04 Author: Amu Description:
Package es Date: 2023/3/27 19:14 Author: Amu Description: 索引模版
Package es Date: 2023/3/28 14:19 Author: Amu Description:
Index ¶
- Constants
- Variables
- type Agg
- type Attr
- type BulkOption
- type BulkProcessor
- func (p *BulkProcessor) Close() error
- func (p *BulkProcessor) Create(indexName string, doc interface{})
- func (p *BulkProcessor) Delete(indexName string, docIDs []string)
- func (p *BulkProcessor) Flush() error
- func (p *BulkProcessor) Start(ctx context.Context) error
- func (p *BulkProcessor) Stats() BulkStats
- func (p *BulkProcessor) Stop() error
- func (p *BulkProcessor) Update(indexName string, docID string, doc interface{})
- type BulkRequest
- type BulkStats
- type Client
- func (c *Client) CountByIndices(ctx context.Context, indexNames []string, options ...CountOption) (int64, error)
- func (c *Client) CreateIndex(ctx context.Context, indexName string, indexBody string) (bool, error)
- func (c *Client) DeleteILMPolicy(ctx context.Context, policyName string) (bool, error)
- func (c *Client) DeleteIndex(ctx context.Context, indexNames []string) error
- func (c *Client) DeleteIndexTemplate(ctx context.Context, templateName string) (bool, error)
- func (c *Client) Find(ctx context.Context, bulkModel Model, options ...QueryOption) (*elastic.SearchResult, error)
- func (c *Client) FindByIndexName(ctx context.Context, indexNames []string, options ...QueryOption) (*elastic.SearchResult, error)
- func (c *Client) FindByIndexNameScroll(ctx context.Context, indexNames []string, scrollID string, size int, ...) (*elastic.SearchResult, error)
- func (c *Client) FindScroll(ctx context.Context, bulkModel Model, scrollID string, size int, ...) (*elastic.SearchResult, error)
- func (c *Client) GetCountService(options ...CountOption) *elastic.CountService
- func (c *Client) GetDeleteService(options ...DeleteOption) *elastic.DeleteService
- func (c *Client) GetILMPolicy(ctx context.Context, policyName string) (map[string]interface{}, error)
- func (c *Client) GetIndexTemplate(ctx context.Context, templateName string) (*elastic.IndicesGetIndexTemplateData, error)
- func (c *Client) GetMappings(ctx context.Context, indexName string) (map[string]interface{}, error)
- func (c *Client) GetQueryService(options ...QueryOption) *elastic.SearchService
- func (c *Client) GetScrollQueryService(options ...ScrollQueryOption) *elastic.ScrollService
- func (c *Client) GetSettings(ctx context.Context, indexName string) (map[string]interface{}, error)
- func (c *Client) ILMPolicyExists(ctx context.Context, policyName string) (bool, error)
- func (c *Client) IndexExists(ctx context.Context, indexName string) (bool, error)
- func (c *Client) IndexStatus(ctx context.Context, indexName string) (indices map[string]*elastic.IndexStats, err error)
- func (c *Client) PutILMPolicy(ctx context.Context, policyName string, policyBody string) (bool, error)
- func (c *Client) PutIndexTemplate(ctx context.Context, templateName string, templateBody string) (bool, error)
- func (c *Client) ReadFile(fileName string) (string, error)
- func (c *Client) Refresh(ctx context.Context, indexName string) error
- func (c *Client) TemplateExists(ctx context.Context, templateName string) (bool, error)
- type ClientOption
- type CountOption
- type CountQuery
- type DeleteOption
- type DeleteQuery
- type Model
- type Page
- type QueryOption
- type ScrollQueryOption
- type Sort
- type SortInfo
Constants ¶
const ( CreateIndexRetry = 50 CreatePolicyRetry = 50 CreateTemplateRetry = 50 PolicyFilePrefix = "policy_" PolicyFileSuffix = ".json" TemplateFilePrefix = "template_" TemplateFileSuffix = ".json" )
Variables ¶
var ( NewMatchQuery = elastic.NewMatchQuery NewTermQuery = elastic.NewTermQuery NewTermsQuery = elastic.NewTermsQuery NewTermsQueryFrom = elastic.NewTermsQueryFromStrings NewBoolQuery = elastic.NewBoolQuery NewRangeQuery = elastic.NewRangeQuery NewNestedQuery = elastic.NewNestedQuery NewMatchAllQuery = elastic.NewMatchAllQuery NewMatchPhraseQuery = elastic.NewMatchPhraseQuery NewMatchPhrasePrefixQuery = elastic.NewMatchPhrasePrefixQuery NewRegexpQuery = elastic.NewRegexpQuery NewTermsAggregation = elastic.NewTermsAggregation NewAvgAggregation = elastic.NewAvgAggregation NewDateRangeAggregation = elastic.NewDateRangeAggregation NewFilterAggregation = elastic.NewFilterAggregation NewFiltersAggregation = elastic.NewFiltersAggregation NewSumAggregation = elastic.NewSumAggregation NewMaxAggregation = elastic.NewMaxAggregation NewMinAggregation = elastic.NewMinAggregation )
Functions ¶
This section is empty.
Types ¶
type Attr ¶
func (*Attr) ActionScroll ¶
func (a *Attr) ActionScroll(service *elastic.SearchService) *elastic.SearchService
type BulkOption ¶
type BulkOption func(*bulkOption)
func WithBulkActions ¶
func WithBulkActions(actions int) BulkOption
func WithBulkFlushInterval ¶
func WithBulkFlushInterval(interval string) BulkOption
func WithBulkSize ¶
func WithBulkSize(size int) BulkOption
func WithBulkWorkers ¶
func WithBulkWorkers(workers int) BulkOption
type BulkProcessor ¶
type BulkProcessor struct {
*elastic.BulkProcessor
}
BulkProcessor 增删改批量操作
func NewBulkProcessor ¶
func NewBulkProcessor(client *Client, opts ...BulkOption) (*BulkProcessor, error)
func (*BulkProcessor) Close ¶
func (p *BulkProcessor) Close() error
func (*BulkProcessor) Create ¶
func (p *BulkProcessor) Create(indexName string, doc interface{})
func (*BulkProcessor) Delete ¶
func (p *BulkProcessor) Delete(indexName string, docIDs []string)
func (*BulkProcessor) Flush ¶
func (p *BulkProcessor) Flush() error
func (*BulkProcessor) Stats ¶
func (p *BulkProcessor) Stats() BulkStats
func (*BulkProcessor) Stop ¶
func (p *BulkProcessor) Stop() error
func (*BulkProcessor) Update ¶
func (p *BulkProcessor) Update(indexName string, docID string, doc interface{})
type BulkRequest ¶
type BulkStats ¶
type BulkStats struct { Flushed int64 // number of times the flush interval has been invoked Committed int64 // # of times workers committed bulk requests Indexed int64 // # of requests indexed Created int64 // # of requests that ES reported as creates (201) Updated int64 // # of requests that ES reported as updates Deleted int64 // # of requests that ES reported as deletes Succeeded int64 // # of requests that ES reported as successful Failed int64 // # of requests that ES reported as failed }
type Client ¶
type Client struct {
*elastic.Client
}
func NewEsClient ¶
func NewEsClient(opts ...ClientOption) (*Client, error)
func (*Client) CountByIndices ¶
func (*Client) CreateIndex ¶
func (*Client) DeleteILMPolicy ¶
func (*Client) DeleteIndex ¶
func (*Client) DeleteIndexTemplate ¶
func (*Client) FindByIndexName ¶
func (*Client) FindByIndexNameScroll ¶
func (*Client) FindScroll ¶
func (*Client) GetCountService ¶
func (c *Client) GetCountService(options ...CountOption) *elastic.CountService
func (*Client) GetDeleteService ¶
func (c *Client) GetDeleteService(options ...DeleteOption) *elastic.DeleteService
func (*Client) GetILMPolicy ¶
func (*Client) GetIndexTemplate ¶
func (*Client) GetMappings ¶
func (*Client) GetQueryService ¶
func (c *Client) GetQueryService(options ...QueryOption) *elastic.SearchService
func (*Client) GetScrollQueryService ¶
func (c *Client) GetScrollQueryService(options ...ScrollQueryOption) *elastic.ScrollService
func (*Client) GetSettings ¶
func (*Client) ILMPolicyExists ¶
func (*Client) IndexExists ¶
func (*Client) IndexStatus ¶
func (*Client) PutILMPolicy ¶
func (*Client) PutIndexTemplate ¶
type ClientOption ¶
type ClientOption func(option *clientOption)
func WithAddr ¶
func WithAddr(addr string) ClientOption
func WithDebug ¶
func WithDebug(debug bool) ClientOption
func WithHealthcheck ¶
func WithHealthcheck(check bool) ClientOption
func WithPassword ¶
func WithPassword(password string) ClientOption
func WithSniff ¶
func WithSniff(sniff bool) ClientOption
func WithUsername ¶
func WithUsername(username string) ClientOption
type CountOption ¶
type CountOption interface {
Action(service *elastic.CountService) *elastic.CountService
}
type CountQuery ¶
type CountQuery struct {
Query elastic.Query
}
func (*CountQuery) Action ¶
func (c *CountQuery) Action(service *elastic.SearchService) *elastic.SearchService
type DeleteOption ¶
type DeleteOption interface {
Action(service *elastic.DeleteService) *elastic.DeleteService
}
type DeleteQuery ¶
type DeleteQuery struct {
Query elastic.Query
}
func (*DeleteQuery) Action ¶
func (d *DeleteQuery) Action(service *elastic.SearchService) *elastic.SearchService
type QueryOption ¶
type QueryOption interface {
Action(service *elastic.SearchService) *elastic.SearchService
}
type ScrollQueryOption ¶
type ScrollQueryOption interface {
ActionScroll(service *elastic.ScrollService) *elastic.ScrollService
}
type Sort ¶
type Sort struct {
Params [][2]interface{}
}
func (*Sort) ActionScroll ¶
func (s *Sort) ActionScroll(service *elastic.SearchService) *elastic.SearchService