es

package
v0.0.0-...-e168591 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 License: MIT, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCreate = "create"
	ActionUpdate = "update"
	ActionDelete = "delete"
	ActionIndex  = "index"
)

See http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/bulk.html

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkRequest

type BulkRequest struct {
	Action string
	Index  string
	Type   string
	ID     string
	Parent string

	Data map[string]interface{}
}

type Client

type Client struct {
	Seelog *mainlog.LoggerInterface
	// contains filtered or unexported fields
}

Although there are many Elasticsearch clients with Go, I still want to implement one by myself. Because we only need some very simple usages.

func NewClient

func NewClient(esServer string) (*Client, error)

+ New es client wrapper

func (*Client) Bulk

func (c *Client) Bulk(items []*BulkRequest) (*elastic.BulkResponse, error)

main es Bulk api only support parent in 'Bulk' related apis

func (*Client) Do

func (c *Client) Do(bulk *elastic.BulkService) (*elastic.BulkResponse, error)

func (*Client) DoBulk

func (c *Client) DoBulk(bulk *elastic.BulkService, items []*BulkRequest) (*elastic.BulkResponse, error)

func (*Client) PrepareIndex

func (c *Client) PrepareIndex(reqs []*BulkRequest, indexs []string) ([]*BulkRequest, error)

stock sku == es index id

func (*Client) PrepareOfflineIndex

func (c *Client) PrepareOfflineIndex(reqs []*BulkRequest, indexs []string) ([]*BulkRequest, error)

t_pro_sell id === ESindex's pid

type Response

type Response struct {
	Code int
	ResponseItem
}

type ResponseItem

type ResponseItem struct {
	ID      string                 `json:"_id"`
	Index   string                 `json:"_index"`
	Type    string                 `json:"_type"`
	Version int                    `json:"_version"`
	Found   bool                   `json:"found"`
	Source  map[string]interface{} `json:"_source"`
}

Jump to

Keyboard shortcuts

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