elastic

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: May 6, 2025 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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