es7

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitClients

func InitClients()

Types

type Client

type Client struct {
	*elastic.Client
}

func GetEsClient

func GetEsClient(key string) *Client

func (*Client) AggregateBySource

func (t *Client) AggregateBySource(ctx context.Context, model elasticsearch.AggregateModel, result ...interface{}) (err error)

func (*Client) BatchInsert

func (t *Client) BatchInsert(ctx context.Context, esIndexName string, ids []string, items []interface{}) (err error)

func (*Client) CreateIndexByMapping

func (t *Client) CreateIndexByMapping(ctx context.Context, esIndexName, esMapping string) (err error)

func (*Client) CreateIndexByModel

func (t *Client) CreateIndexByModel(ctx context.Context, esIndexName string, model *MappingModel) (err error)

func (*Client) DeleteById

func (t *Client) DeleteById(ctx context.Context, esIndexName, id string) (err error)

func (*Client) FindByModel

func (t *Client) FindByModel(ctx context.Context, model elasticsearch.QueryModel) error

func (*Client) FindBySource

func (t *Client) FindBySource(ctx context.Context, model elasticsearch.SourceModel) error

func (*Client) Insert

func (t *Client) Insert(ctx context.Context, esIndexName, id string, data interface{}) (err error)

func (*Client) UpdateById

func (t *Client) UpdateById(ctx context.Context, esIndexName, id string, updateM map[string]interface{}) (err error)

type Mapping

type Mapping struct {
	Dynamic    bool                              `json:"dynamic"` // false
	Properties map[string]map[string]interface{} `json:"properties"`
}

type MappingModel

type MappingModel struct {
	Mapping  `json:"mappings"`
	Settings `json:"settings"`
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

type Settings

type Settings struct {
	IndexMappingIgnoreMalformed bool  `json:"index.mapping.ignore_malformed"` // true
	NumberOfReplicas            int64 `json:"number_of_replicas"`             // 1
	NumberOfShards              int64 `json:"number_of_shards"`               // 3
}

Jump to

Keyboard shortcuts

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