Documentation
¶
Overview ¶
Package elastic provides an Elasticsearch client with AWS sigv4 support.
Index ¶
- type AWSCredentials
- type BulkResponse
- type BulkResponseItem
- type BulkResponseItemResult
- type Client
- func (c *Client) Aliases() (v aliases.Indexes, err error)
- func (c *Client) Bulk(body io.Reader) error
- func (c *Client) BulkResponse(body io.Reader) (res *BulkResponse, err error)
- func (c *Client) DeleteAll() error
- func (c *Client) DeleteIndex(index string) error
- func (c *Client) RefreshAll() error
- func (c *Client) RefreshIndex(index string) error
- func (c *Client) RemoveOldAliases(layout, alias string, n int, now time.Time) error
- func (c *Client) RemoveOldIndexes(layout string, n int, now time.Time) error
- func (c *Client) Request(method, path string, body io.Reader, v interface{}) error
- func (c *Client) SearchIndex(index string, query interface{}, v interface{}) error
- func (c *Client) SearchIndexString(index, query string, v interface{}) error
- func (c *Client) SearchIndexTemplate(index, tmpl string, data interface{}, v interface{}) error
- func (c *Client) SetAWSCredentials(credentials AWSCredentials)
- func (c *Client) SetAuthCredentials(username, password string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkResponse ¶
type BulkResponse struct {
Took float64 `json:"took"`
Errors bool `json:"errors"`
Items []*BulkResponseItem `json:"items"`
}
BulkResponse for _bulk.
type BulkResponseItem ¶
type BulkResponseItem struct {
Create *BulkResponseItemResult `json:"create,omitempty"`
Delete *BulkResponseItemResult `json:"delete,omitempty"`
Update *BulkResponseItemResult `json:"update,omitempty"`
Index *BulkResponseItemResult `json:"index,omitempty"`
}
BulkResponseItem for _bulk.
type BulkResponseItemResult ¶
type BulkResponseItemResult struct {
Index string `json:"_index"`
Type string `json:"_type"`
ID string `json:"_id"`
Version int `json:"_version"`
Status int `json:"status"`
Found bool `json:"bool,omitempty"`
Error string `json:"error,omitempty"`
}
BulkResponseItem for _bulk request responses.
type Client ¶
type Client struct {
HTTPClient *http.Client
URL string // URL to Elasticsearch cluster
// contains filtered or unexported fields
}
Client is an Elasticsearch client.
func (*Client) BulkResponse ¶
func (c *Client) BulkResponse(body io.Reader) (res *BulkResponse, err error)
BulkResponse POST request with the given body and return response.
func (*Client) DeleteIndex ¶
DeleteIndex deletes `index`.
func (*Client) RefreshIndex ¶
RefreshIndex refreshes `index`.
func (*Client) RemoveOldAliases ¶
RemoveOldAliases removes `alias` from timeseries style indexes older than `n` days based on `layout` such as "logs-06-01-02". For example to maintain the past week (inclusive) you might use RemoveOldAliases("logs-06-01-02", "last_week", 8, time.Now()).
func (*Client) RemoveOldIndexes ¶
RemoveOldIndexes removes indexes from timeseries style indexes older than `n` days based on `layout` such as "logs-06-01-02". For example to maintain the past week (inclusive) you might use RemoveOldIndexes("logs-06-01-02", 8, time.Now()).
func (*Client) Request ¶
Request performs a request against `url` storing the results as `v` when non-nil.
func (*Client) SearchIndex ¶
SearchIndex queries `index` and stores the results of `query` in `v`.
func (*Client) SearchIndexString ¶
SearchIndexString queries `index` and stores the results of `query` in `v`.
func (*Client) SearchIndexTemplate ¶
SearchIndexTemplate queries `index` with `tmpl` string and stores the results in `v`.
func (*Client) SetAWSCredentials ¶
func (c *Client) SetAWSCredentials(credentials AWSCredentials)
SetAWSCredentials for connection to an AWS ElasticSearch instance
func (*Client) SetAuthCredentials ¶
SetAuthCredentials for a username/password connection