get

package
v9.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Get snapshot information.

NOTE: The `after` parameter and `next` field enable you to iterate through snapshots with some consistency guarantees regarding concurrent creation or deletion of snapshots. It is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently deleted will be seen during the iteration. Snapshots concurrently created may be seen during an iteration.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

type Get

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

func New

Get snapshot information.

NOTE: The `after` parameter and `next` field enable you to iterate through snapshots with some consistency guarantees regarding concurrent creation or deletion of snapshots. It is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently deleted will be seen during the iteration. Snapshots concurrently created may be seen during an iteration.

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-snapshot-get

func (*Get) After

func (r *Get) After(after string) *Get

After An offset identifier to start pagination from as returned by the next field in the response body. API name: after

func (Get) Do

func (r Get) Do(providedCtx context.Context) (*Response, error)

Do runs the request through the transport, handle the response and returns a get.Response

func (*Get) ErrorTrace

func (r *Get) ErrorTrace(errortrace bool) *Get

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace

func (*Get) FilterPath

func (r *Get) FilterPath(filterpaths ...string) *Get

FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path

func (*Get) FromSortValue

func (r *Get) FromSortValue(fromsortvalue string) *Get

FromSortValue The value of the current sort column at which to start retrieval. It can be a string `snapshot-` or a repository name when sorting by snapshot or repository name. It can be a millisecond time value or a number when sorting by `index-` or shard count. API name: from_sort_value

func (*Get) Header

func (r *Get) Header(key, value string) *Get

Header set a key, value pair in the Get headers map.

func (*Get) HttpRequest

func (r *Get) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*Get) Human

func (r *Get) Human(human bool) *Get

Human When set to `true` will return statistics in a format suitable for humans. For example `"exists_time": "1h"` for humans and `"exists_time_in_millis": 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human

func (*Get) IgnoreUnavailable

func (r *Get) IgnoreUnavailable(ignoreunavailable bool) *Get

IgnoreUnavailable If `false`, the request returns an error for any snapshots that are unavailable. API name: ignore_unavailable

func (*Get) IncludeRepository

func (r *Get) IncludeRepository(includerepository bool) *Get

IncludeRepository If `true`, the response includes the repository name in each snapshot. API name: include_repository

func (*Get) IndexDetails

func (r *Get) IndexDetails(indexdetails bool) *Get

IndexDetails If `true`, the response includes additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. The default is `false`, meaning that this information is omitted. API name: index_details

func (*Get) IndexNames

func (r *Get) IndexNames(indexnames bool) *Get

IndexNames If `true`, the response includes the name of each index in each snapshot. API name: index_names

func (Get) IsSuccess

func (r Get) IsSuccess(providedCtx context.Context) (bool, error)

IsSuccess allows to run a query with a context and retrieve the result as a boolean. This only exists for endpoints without a request payload and allows for quick control flow.

func (*Get) MasterTimeout

func (r *Get) MasterTimeout(duration string) *Get

MasterTimeout The period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. API name: master_timeout

func (*Get) Offset

func (r *Get) Offset(offset int) *Get

Offset Numeric offset to start pagination from based on the snapshots matching this request. Using a non-zero value for this parameter is mutually exclusive with using the after parameter. Defaults to 0. API name: offset

func (*Get) Order

func (r *Get) Order(order sortorder.SortOrder) *Get

Order The sort order. Valid values are `asc` for ascending and `desc` for descending order. The default behavior is ascending order. API name: order

func (Get) Perform

func (r Get) Perform(providedCtx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*Get) Pretty

func (r *Get) Pretty(pretty bool) *Get

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty

func (*Get) Size

func (r *Get) Size(size int) *Get

Size The maximum number of snapshots to return. The default is 0, which means to return all that match the request without limit. API name: size

func (*Get) SlmPolicyFilter

func (r *Get) SlmPolicyFilter(name string) *Get

SlmPolicyFilter Filter snapshots by a comma-separated list of snapshot lifecycle management (SLM) policy names that snapshots belong to.

You can use wildcards (`*`) and combinations of wildcards followed by exclude patterns starting with `-`. For example, the pattern `*,-policy-a-\*` will return all snapshots except for those that were created by an SLM policy with a name starting with `policy-a-`. Note that the wildcard pattern `*` matches all snapshots created by an SLM policy but not those snapshots that were not created by an SLM policy. To include snapshots that were not created by an SLM policy, you can use the special pattern `_none` that will match all snapshots without an SLM policy. API name: slm_policy_filter

func (*Get) Sort

func (r *Get) Sort(sort snapshotsort.SnapshotSort) *Get

Sort The sort order for the result. The default behavior is sorting by snapshot start time stamp. API name: sort

func (*Get) State added in v9.1.0

func (r *Get) State(states ...snapshotstate.SnapshotState) *Get

State Only return snapshots with a state found in the given comma-separated list of snapshot states. The default is all snapshot states. API name: state

func (*Get) Verbose

func (r *Get) Verbose(verbose bool) *Get

Verbose If `true`, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted.

NOTE: The parameters `size`, `order`, `after`, `from_sort_value`, `offset`, `slm_policy_filter`, and `sort` are not supported when you set `verbose=false` and the sort order for requests with `verbose=false` is undefined. API name: verbose

type NewGet

type NewGet func(repository, snapshot string) *Get

NewGet type alias for index.

func NewGetFunc

func NewGetFunc(tp elastictransport.Interface) NewGet

NewGetFunc returns a new instance of Get with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type Response

type Response struct {

	// Next If the request contained a size limit and there might be more results, a
	// `next` field will be added to the response.
	// It can be used as the `after` query parameter to fetch additional results.
	Next *string `json:"next,omitempty"`
	// Remaining The number of remaining snapshots that were not returned due to size limits
	// and that can be fetched by additional requests using the `next` field value.
	Remaining int                          `json:"remaining"`
	Responses []types.SnapshotResponseItem `json:"responses,omitempty"`
	Snapshots []types.SnapshotInfo         `json:"snapshots,omitempty"`
	// Total The total number of snapshots that match the request when ignoring the size
	// limit or `after` query parameter.
	Total int `json:"total"`
}

Response holds the response body struct for the package get

https://github.com/elastic/elasticsearch-specification/blob/907d11a72a6bfd37b777d526880c56202889609e/specification/snapshot/get/SnapshotGetResponse.ts#L25-L47

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

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