scroll

package
v8.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Overview

Allows to retrieve a large numbers of results from a single search request.

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 NewScroll

type NewScroll func() *Scroll

NewScroll type alias for index.

func NewScrollFunc

func NewScrollFunc(tp elastictransport.Interface) NewScroll

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

type Request

type Request struct {

	// Scroll Period to retain the search context for scrolling.
	Scroll types.Duration `json:"scroll,omitempty"`
	// ScrollId Scroll ID of the search.
	ScrollId string `json:"scroll_id"`
}

Request holds the request body struct for the package scroll

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/scroll/ScrollRequest.ts#L24-L59

func NewRequest added in v8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON added in v8.5.0

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

func (*Request) UnmarshalJSON added in v8.12.1

func (s *Request) UnmarshalJSON(data []byte) error

type Response added in v8.7.0

type Response struct {
	Aggregations    map[string]types.Aggregate `json:"aggregations,omitempty"`
	Clusters_       *types.ClusterStatistics   `json:"_clusters,omitempty"`
	Fields          map[string]json.RawMessage `json:"fields,omitempty"`
	Hits            types.HitsMetadata         `json:"hits"`
	MaxScore        *types.Float64             `json:"max_score,omitempty"`
	NumReducePhases *int64                     `json:"num_reduce_phases,omitempty"`
	PitId           *string                    `json:"pit_id,omitempty"`
	Profile         *types.Profile             `json:"profile,omitempty"`
	ScrollId_       *string                    `json:"_scroll_id,omitempty"`
	Shards_         types.ShardStatistics      `json:"_shards"`
	Suggest         map[string][]types.Suggest `json:"suggest,omitempty"`
	TerminatedEarly *bool                      `json:"terminated_early,omitempty"`
	TimedOut        bool                       `json:"timed_out"`
	Took            int64                      `json:"took"`
}

Response holds the response body struct for the package scroll

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/scroll/ScrollResponse.ts#L22-L24

func NewResponse added in v8.7.0

func NewResponse() *Response

NewResponse returns a Response

func (*Response) UnmarshalJSON added in v8.7.0

func (s *Response) UnmarshalJSON(data []byte) error

type Scroll

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

func New

Allows to retrieve a large numbers of results from a single search request.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-scroll

func (Scroll) Do

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

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

func (*Scroll) Header

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

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

func (*Scroll) HttpRequest

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

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

func (Scroll) Perform added in v8.7.0

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

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

func (*Scroll) Raw

func (r *Scroll) Raw(raw io.Reader) *Scroll

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*Scroll) Request

func (r *Scroll) Request(req *Request) *Scroll

Request allows to set the request property with the appropriate payload.

func (*Scroll) RestTotalHitsAsInt

func (r *Scroll) RestTotalHitsAsInt(resttotalhitsasint bool) *Scroll

RestTotalHitsAsInt If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. API name: rest_total_hits_as_int

func (*Scroll) Scroll

func (r *Scroll) Scroll(duration types.Duration) *Scroll

Scroll Period to retain the search context for scrolling. API name: scroll

func (*Scroll) ScrollId

func (r *Scroll) ScrollId(scrollid string) *Scroll

ScrollId Scroll ID of the search. API name: scroll_id

Jump to

Keyboard shortcuts

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