elastic

package
v0.2.20 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeLayout = "20060102150405"
)

Variables

This section is empty.

Functions

func String

func String(v interface{}, err error) (string, error)

Types

type BulkRequest

type BulkRequest struct {
	Index    string
	ID       string
	Document interface{}
}

type BulkResult

type BulkResult struct {
	Errors  []error
	Indexed int
}

func (*BulkResult) AppendError

func (bres *BulkResult) AppendError(format string, a ...interface{})

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() (*Client, error)

func (*Client) AddAliasAndDeleteIndex

func (c *Client) AddAliasAndDeleteIndex(newIndex string, alias string) (bool, error)

func (*Client) Delete

func (c *Client) Delete(index string, id string) error

func (*Client) DeleteIndex

func (c *Client) DeleteIndex(index string) (bool, error)

func (*Client) Exists

func (c *Client) Exists(index string, id string) bool

func (*Client) GetDocumentById

func (c *Client) GetDocumentById(index string, id string, v interface{}) error

func (*Client) GetDocumentByQuery

func (c *Client) GetDocumentByQuery(ctx context.Context, index string, query map[string]interface{}, v interface{}) (*string, error)

func (*Client) GetDocumentField

func (c *Client) GetDocumentField(index string, id string, key string) (interface{}, error)

func (*Client) Index

func (c *Client) Index(index string, id string, v interface{}) error

func (*Client) Search

func (c *Client) Search(ctx context.Context, index string, query string) (*ElasticSearchResult, error)

func (*Client) Update

func (c *Client) Update(index string, id string, v interface{}) error

type ElasticAggregateBucket

type ElasticAggregateBucket struct {
	DocCount int         `json:"doc_count"`
	Key      interface{} `json:"key"`
}

type ElasticResultHit

type ElasticResultHit struct {
	Index  string          `json:"_index"`
	Type   string          `json:"_type"`
	ID     string          `json:"_id"`
	Score  float64         `json:"_score"`
	Source json.RawMessage `json:"_source"`
	Fields json.RawMessage `json:"fields,omitempty"`
	Sort   []int64         `json:"sort,omitempty"`
}

type ElasticResultHits

type ElasticResultHits struct {
	Total    ElasticResultTotal `json:"total"`
	MaxScore float64            `json:"max_score"`
	Hits     []ElasticResultHit `json:"hits"`
}

type ElasticResultShards

type ElasticResultShards struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Skipped    int `json:"skipped"`
	Failed     int `json:"failed"`
}

type ElasticResultTotal

type ElasticResultTotal struct {
	Value    int    `json:"value"`
	Relation string `json:"relation"`
}

type ElasticSearchResult

type ElasticSearchResult struct {
	Took         int                 `json:"took"`
	TimedOut     bool                `json:"timed_out"`
	Shards       ElasticResultShards `json:"_shards"`
	Hits         ElasticResultHits   `json:"hits"`
	Aggregations json.RawMessage     `json:"aggregations"`
}

Jump to

Keyboard shortcuts

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