Documentation ¶
Index ¶
- type BulkProcessor
- type Client
- func (c *Client) AddBulkProcessor(bulkProcessor BulkProcessor) (err error)
- func (c *Client) BulkStore(ctx context.Context, indexName string, processorName string, ...) (err error)
- func (c *Client) GetBulkProcessor(name string) (processor *es.BulkProcessor, err error)
- func (c *Client) Ping(ctx context.Context, nodeURL string) (*es.PingResult, int, error)
- func (c *Client) Remove(ctx context.Context, indexName string, id string) (res *es.DeleteResponse, err error)
- func (c *Client) RemoveIndex(ctx context.Context, indexName ...string) (res *es.IndicesDeleteResponse, err error)
- func (c *Client) Search(ctx context.Context, indexName string, option SearchOption) (result []byte, err error)
- func (c *Client) Store(ctx context.Context, name string, doc interface{}, template *DynamicTemplate) (res *es.IndexResponse, err error)
- type ClientConfig
- type DynamicTemplate
- type ElasticBasicActions
- type ElasticBulkActions
- type ElasticClient
- type ElasticRetrier
- type Field
- type Mappings
- type MatchConditions
- type MatchMapping
- type Property
- type SearchOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkProcessor ¶
type Client ¶
type Client struct { Config ClientConfig // contains filtered or unexported fields }
func (*Client) AddBulkProcessor ¶
func (c *Client) AddBulkProcessor(bulkProcessor BulkProcessor) (err error)
func (*Client) BulkStore ¶
func (c *Client) BulkStore(ctx context.Context, indexName string, processorName string, docs []interface{}, template *DynamicTemplate) (err error)
BulkStore bulk index(upsert) document to elastic
func (*Client) GetBulkProcessor ¶
func (c *Client) GetBulkProcessor(name string) (processor *es.BulkProcessor, err error)
func (*Client) Remove ¶
func (c *Client) Remove(ctx context.Context, indexName string, id string) (res *es.DeleteResponse, err error)
Delete delete document to elastic
func (*Client) RemoveIndex ¶
func (c *Client) RemoveIndex(ctx context.Context, indexName ...string) (res *es.IndicesDeleteResponse, err error)
Delete delete document to elastic
func (*Client) Store ¶
func (c *Client) Store(ctx context.Context, name string, doc interface{}, template *DynamicTemplate) (res *es.IndexResponse, err error)
Index index(upsert) document to elastic
type ClientConfig ¶
type ClientConfig struct {
BulkProcessors map[string]*es.BulkProcessor
}
type DynamicTemplate ¶
type ElasticBasicActions ¶
type ElasticBasicActions interface { Search(ctx context.Context, indexName string, option SearchOption) (result []byte, err error) Store(ctx context.Context, name string, doc interface{}, template *DynamicTemplate) (res *es.IndexResponse, err error) Remove(ctx context.Context, indexName string, id string) (res *es.DeleteResponse, err error) RemoveIndex(ctx context.Context, indexName ...string) (res *es.IndicesDeleteResponse, err error) Ping(ctx context.Context, nodeURL string) (*es.PingResult, int, error) }
type ElasticBulkActions ¶
type ElasticBulkActions interface { AddBulkProcessor(bulkProcessor BulkProcessor) (err error) BulkStore(ctx context.Context, indexName string, processorName string, docs []interface{}, template *DynamicTemplate) (err error) }
type ElasticClient ¶
type ElasticClient interface { ElasticBasicActions ElasticBulkActions }
func NewClient ¶
func NewClient(urls ...string) (c ElasticClient, err error)
type ElasticRetrier ¶
type ElasticRetrier struct {
// contains filtered or unexported fields
}
func NewElasticRetrier ¶
func NewElasticRetrier(t time.Duration, f func(err error)) *ElasticRetrier
type Mappings ¶
type Mappings struct { DynamicTemplates []map[string]MatchConditions `json:"dynamic_templates"` Properties map[string]Property `json:"properties"` }
func (*Mappings) AddDynamicTemplate ¶
func (es *Mappings) AddDynamicTemplate(name string, matchCondition MatchConditions) *Mappings
AddDynamicTemplate
func (*Mappings) AddPropertyWithType ¶
AddPropertyWithType
type MatchConditions ¶
type MatchConditions struct { Match string `json:"match,omitempty"` UnMatch string `json:"unmatch,omitempty"` PathMatch string `json:"path_match,omitempty"` MatchMappingType string `json:"match_mapping_type,omitempty"` Mapping MatchMapping `json:"mapping,omitempty"` }
ESDynamicTemplate https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html
type MatchMapping ¶
Click to show internal directories.
Click to hide internal directories.