scroll
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Run a scrolling search.
IMPORTANT: The scroll API is no longer recommend for deep pagination. If youneed to preserve the index state while paging through more than 10,000 hits,use the `search_after` parameter with a point in time (PIT).
The scroll API gets large sets of results from a single scrolling searchrequest.To get the necessary scroll ID, submit a search API request that includes anargument for the `scroll` query parameter.The `scroll` parameter indicates how long Elasticsearch should retain thesearch context for the request.The search response returns a scroll ID in the `_scroll_id` response bodyparameter.You can then use the scroll ID with the scroll API to retrieve the next batchof results for the request.If the Elasticsearch security features are enabled, the access to the resultsof a specific scroll ID is restricted to the user or API key that submittedthe search.
You can also use the scroll API to specify a new scroll parameter thatextends or shortens the retention period for the search context.
IMPORTANT: Results from a scrolling search reflect the state of the index atthe time of the initial search request. Subsequent indexing or documentchanges only affect later search and scroll requests.
Index¶
- Variables
- type NewScroll
- type Request
- type Response
- type Scroll
- func (r Scroll) Do(providedCtx context.Context) (*Response, error)
- func (r *Scroll) ErrorTrace(errortrace bool) *Scroll
- func (r *Scroll) FilterPath(filterpaths ...string) *Scroll
- func (r *Scroll) Header(key, value string) *Scroll
- func (r *Scroll) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Scroll) Human(human bool) *Scroll
- func (r Scroll) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Scroll) Pretty(pretty bool) *Scroll
- func (r *Scroll) Raw(raw io.Reader) *Scroll
- func (r *Scroll) Request(req *Request) *Scroll
- func (r *Scroll) RestTotalHitsAsInt(resttotalhitsasint bool) *Scroll
- func (r *Scroll) Scroll(duration types.Duration) *Scroll
- func (r *Scroll) ScrollId(scrollid string) *Scroll
Constants¶
This section is empty.
Variables¶
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¶
typeNewScroll¶
type NewScroll func() *Scroll
NewScroll type alias for index.
funcNewScrollFunc¶
func NewScrollFunc(tpelastictransport.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.
typeRequest¶
type Request struct {// Scroll The period to retain the search context for scrolling.Scrolltypes.Duration `json:"scroll,omitempty"`// ScrollId The scroll ID of the search.ScrollIdstring `json:"scroll_id"`}Request holds the request body struct for the package scroll
func (*Request)FromJSON¶added inv8.5.0
FromJSON allows to load an arbitrary json into the request structure
func (*Request)UnmarshalJSON¶added inv8.12.1
typeResponse¶added inv8.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 The returned documents and metadata.Hitstypes.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_ The identifier for the search and its search context.// You can use this scroll ID with the scroll API to retrieve the next batch of// search results for the request.// This property is returned only if the `scroll` query parameter is specified// in the request.ScrollId_ *string `json:"_scroll_id,omitempty"`// Shards_ A count of shards used for the request.Shards_types.ShardStatistics `json:"_shards"`Suggest map[string][]types.Suggest `json:"suggest,omitempty"`TerminatedEarly *bool `json:"terminated_early,omitempty"`// TimedOut If `true`, the request timed out before completion; returned results may be// partial or empty.TimedOutbool `json:"timed_out"`// Took The number of milliseconds it took Elasticsearch to run the request.// This value is calculated by measuring the time elapsed between receipt of a// request on the coordinating node and the time at which the coordinating node// is ready to send the response.// It includes://// * Communication time between the coordinating node and data nodes// * Time the request spends in the search thread pool, queued for execution// * Actual run time//// It does not include://// * Time needed to send the request to Elasticsearch// * Time needed to serialize the JSON response// * Time needed to send the response to a clientTookint64 `json:"took"`}Response holds the response body struct for the package scroll
func (*Response)UnmarshalJSON¶added inv8.7.0
typeScroll¶
type Scroll struct {// contains filtered or unexported fields}funcNew¶
func New(tpelastictransport.Interface) *Scroll
Run a scrolling search.
IMPORTANT: The scroll API is no longer recommend for deep pagination. If youneed to preserve the index state while paging through more than 10,000 hits,use the `search_after` parameter with a point in time (PIT).
The scroll API gets large sets of results from a single scrolling searchrequest.To get the necessary scroll ID, submit a search API request that includes anargument for the `scroll` query parameter.The `scroll` parameter indicates how long Elasticsearch should retain thesearch context for the request.The search response returns a scroll ID in the `_scroll_id` response bodyparameter.You can then use the scroll ID with the scroll API to retrieve the next batchof results for the request.If the Elasticsearch security features are enabled, the access to the resultsof a specific scroll ID is restricted to the user or API key that submittedthe search.
You can also use the scroll API to specify a new scroll parameter thatextends or shortens the retention period for the search context.
IMPORTANT: Results from a scrolling search reflect the state of the index atthe time of the initial search request. Subsequent indexing or documentchanges only affect later search and scroll requests.
https://www.elastic.co/guide/en/elasticsearch/reference/current/scroll-api.html
func (Scroll)Do¶
Do runs the request through the transport, handle the response and returns a scroll.Response
func (*Scroll)ErrorTrace¶added inv8.14.0
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errorswhen they occur.API name: error_trace
func (*Scroll)FilterPath¶added inv8.14.0
FilterPath Comma-separated list of filters in dot notation which reduce the responsereturned by Elasticsearch.API name: filter_path
func (*Scroll)HttpRequest¶
HttpRequest returns the http.Request object built from thegiven parameters.
func (*Scroll)Human¶added inv8.14.0
Human When set to `true` will return statistics in a format suitable for humans.For example `"exists_time": "1h"` for humans and`"eixsts_time_in_millis": 3600000` for computers. When disabled the humanreadable values will be omitted. This makes sense for responses beingconsumedonly by machines.API name: human
func (Scroll)Perform¶added inv8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Scroll)Pretty¶added inv8.14.0
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only usethis option for debugging only.API name: pretty
func (*Scroll)Raw¶
Raw takes a json payload as input which is then passed to the http.RequestIf specified Raw takes precedence on Request method.
func (*Scroll)RestTotalHitsAsInt¶
RestTotalHitsAsInt If true, the API response’s hit.total property is returned as an integer. Iffalse, the API response’s hit.total property is returned as an object.API name: rest_total_hits_as_int