Movatterモバイル変換


[0]ホーム

URL:


Notice  The highest tagged major version isv9.

submit

package
v8.19.1Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License:Apache-2.0Imports:16Imported by:4

Details

Repository

github.com/elastic/go-elasticsearch

Links

Documentation

Overview

Run an async search.

When the primary sort of the results is an indexed field, shards get sortedbased on minimum and maximum value that they hold for that field. Partialresults become available following the sort criteria that was requested.

Warning: Asynchronous search does not support scroll or search requests thatinclude only the suggest section.

By default, Elasticsearch does not allow you to store an async searchresponse larger than 10Mb and an attempt to do this results in an error.The maximum allowed size for a stored async search response can be set bychanging the `search.max_async_search_response_size` cluster level setting.

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

typeNewSubmit

type NewSubmit func() *Submit

NewSubmit type alias for index.

funcNewSubmitFunc

func NewSubmitFunc(tpelastictransport.Interface)NewSubmit

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

typeRequest

type Request struct {Aggregations map[string]types.Aggregations `json:"aggregations,omitempty"`Collapse     *types.FieldCollapse          `json:"collapse,omitempty"`// DocvalueFields Array of wildcard (*) patterns. The request returns doc values for field// names matching these patterns in the hits.fields property of the response.DocvalueFields []types.FieldAndFormat `json:"docvalue_fields,omitempty"`// Explain If true, returns detailed information about score computation as part of a// hit.Explain *bool `json:"explain,omitempty"`// Ext Configuration of search extensions defined by Elasticsearch plugins.Ext map[string]json.RawMessage `json:"ext,omitempty"`// Fields Array of wildcard (*) patterns. The request returns values for field names// matching these patterns in the hits.fields property of the response.Fields []types.FieldAndFormat `json:"fields,omitempty"`// From Starting document offset. By default, you cannot page through more than// 10,000// hits using the from and size parameters. To page through more hits, use the// search_after parameter.From      *int             `json:"from,omitempty"`Highlight *types.Highlight `json:"highlight,omitempty"`// IndicesBoost Boosts the _score of documents from specified indices.IndicesBoost []map[string]types.Float64 `json:"indices_boost,omitempty"`// Knn Defines the approximate kNN search to run.Knn []types.KnnSearch `json:"knn,omitempty"`// MinScore Minimum _score for matching documents. Documents with a lower _score are// not included in search results and results collected by aggregations.MinScore *types.Float64 `json:"min_score,omitempty"`// Pit Limits the search to a point in time (PIT). If you provide a PIT, you// cannot specify an <index> in the request path.Pit        *types.PointInTimeReference `json:"pit,omitempty"`PostFilter *types.Query                `json:"post_filter,omitempty"`Profile    *bool                       `json:"profile,omitempty"`// Query Defines the search definition using the Query DSL.Query   *types.Query    `json:"query,omitempty"`Rescore []types.Rescore `json:"rescore,omitempty"`// RuntimeMappings Defines one or more runtime fields in the search request. These fields take// precedence over mapped fields with the same name.RuntimeMappingstypes.RuntimeFields `json:"runtime_mappings,omitempty"`// ScriptFields Retrieve a script evaluation (based on different fields) for each hit.ScriptFields map[string]types.ScriptField `json:"script_fields,omitempty"`SearchAfter  []types.FieldValue           `json:"search_after,omitempty"`// SeqNoPrimaryTerm If true, returns sequence number and primary term of the last modification// of each hit. See Optimistic concurrency control.SeqNoPrimaryTerm *bool `json:"seq_no_primary_term,omitempty"`// Size The number of hits to return. By default, you cannot page through more// than 10,000 hits using the from and size parameters. To page through more// hits, use the search_after parameter.Size  *int                     `json:"size,omitempty"`Slice *types.SlicedScroll      `json:"slice,omitempty"`Sort  []types.SortCombinations `json:"sort,omitempty"`// Source_ Indicates which source fields are returned for matching documents. These// fields are returned in the hits._source property of the search response.Source_types.SourceConfig `json:"_source,omitempty"`// Stats Stats groups to associate with the search. Each group maintains a statistics// aggregation for its associated searches. You can retrieve these stats using// the indices stats API.Stats []string `json:"stats,omitempty"`// StoredFields List of stored fields to return as part of a hit. If no fields are specified,// no stored fields are included in the response. If this field is specified,// the _source// parameter defaults to false. You can pass _source: true to return both source// fields// and stored fields in the search response.StoredFields []string         `json:"stored_fields,omitempty"`Suggest      *types.Suggester `json:"suggest,omitempty"`// TerminateAfter Maximum number of documents to collect for each shard. If a query reaches// this// limit, Elasticsearch terminates the query early. Elasticsearch collects// documents// before sorting. Defaults to 0, which does not terminate query execution// early.TerminateAfter *int64 `json:"terminate_after,omitempty"`// Timeout Specifies the period of time to wait for a response from each shard. If no// response// is received before the timeout expires, the request fails and returns an// error.// Defaults to no timeout.Timeout *string `json:"timeout,omitempty"`// TrackScores If true, calculate and return document scores, even if the scores are not// used for sorting.TrackScores *bool `json:"track_scores,omitempty"`// TrackTotalHits Number of hits matching the query to count accurately. If true, the exact// number of hits is returned at the cost of some performance. If false, the// response does not include the total number of hits matching the query.// Defaults to 10,000 hits.TrackTotalHitstypes.TrackHits `json:"track_total_hits,omitempty"`// Version If true, returns document version as part of a hit.Version *bool `json:"version,omitempty"`}

Request holds the request body struct for the package submit

https://github.com/elastic/elasticsearch-specification/blob/470b4b9aaaa25cae633ec690e54b725c6fc939c7/specification/async_search/submit/AsyncSearchSubmitRequest.ts#L54-L294

funcNewRequestadded inv8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request)FromJSONadded inv8.5.0

func (r *Request) FromJSON(datastring) (*Request,error)

FromJSON allows to load an arbitrary json into the request structure

func (*Request)UnmarshalJSONadded inv8.12.1

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

typeResponseadded inv8.7.0

type Response struct {// CompletionTime Indicates when the async search completed.// It is present only when the search has completed.CompletionTimetypes.DateTime `json:"completion_time,omitempty"`CompletionTimeInMillis *int64         `json:"completion_time_in_millis,omitempty"`// ExpirationTime Indicates when the async search will expire.ExpirationTimetypes.DateTime `json:"expiration_time,omitempty"`ExpirationTimeInMillisint64          `json:"expiration_time_in_millis"`Id                     *string        `json:"id,omitempty"`// IsPartial When the query is no longer running, this property indicates whether the// search failed or was successfully completed on all shards.// While the query is running, `is_partial` is always set to `true`.IsPartialbool `json:"is_partial"`// IsRunning Indicates whether the search is still running or has completed.//// > info// > If the search failed after some shards returned their results or the node// that is coordinating the async search dies, results may be partial even// though `is_running` is `false`.IsRunningbool              `json:"is_running"`Responsetypes.AsyncSearch `json:"response"`StartTimetypes.DateTime    `json:"start_time,omitempty"`StartTimeInMillisint64             `json:"start_time_in_millis"`}

Response holds the response body struct for the package submit

https://github.com/elastic/elasticsearch-specification/blob/470b4b9aaaa25cae633ec690e54b725c6fc939c7/specification/async_search/submit/AsyncSearchSubmitResponse.ts#L22-L24

funcNewResponseadded inv8.7.0

func NewResponse() *Response

NewResponse returns a Response

func (*Response)UnmarshalJSONadded inv8.15.0

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

typeSubmit

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

funcNew

Run an async search.

When the primary sort of the results is an indexed field, shards get sortedbased on minimum and maximum value that they hold for that field. Partialresults become available following the sort criteria that was requested.

Warning: Asynchronous search does not support scroll or search requests thatinclude only the suggest section.

By default, Elasticsearch does not allow you to store an async searchresponse larger than 10Mb and an attempt to do this results in an error.The maximum allowed size for a stored async search response can be set bychanging the `search.max_async_search_response_size` cluster level setting.

https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html

func (*Submit)Aggregationsadded inv8.9.0

func (r *Submit) Aggregations(aggregations map[string]types.Aggregations) *Submit

API name: aggregations

func (*Submit)AllowNoIndices

func (r *Submit) AllowNoIndices(allownoindicesbool) *Submit

AllowNoIndices Whether to ignore if a wildcard indices expression resolves into no concreteindices. (This includes `_all` string or when no indices have been specified)API name: allow_no_indices

func (*Submit)AllowPartialSearchResults

func (r *Submit) AllowPartialSearchResults(allowpartialsearchresultsbool) *Submit

AllowPartialSearchResults Indicate if an error should be returned if there is a partial search failureor timeoutAPI name: allow_partial_search_results

func (*Submit)AnalyzeWildcard

func (r *Submit) AnalyzeWildcard(analyzewildcardbool) *Submit

AnalyzeWildcard Specify whether wildcard and prefix queries should be analyzed (default:false)API name: analyze_wildcard

func (*Submit)Analyzer

func (r *Submit) Analyzer(analyzerstring) *Submit

Analyzer The analyzer to use for the query stringAPI name: analyzer

func (*Submit)BatchedReduceSize

func (r *Submit) BatchedReduceSize(batchedreducesizestring) *Submit

BatchedReduceSize Affects how often partial results become available, which happens whenevershard results are reduced.A partial reduction is performed every time the coordinating node hasreceived a certain number of new shard responses (5 by default).API name: batched_reduce_size

func (*Submit)CcsMinimizeRoundtrips

func (r *Submit) CcsMinimizeRoundtrips(ccsminimizeroundtripsbool) *Submit

CcsMinimizeRoundtrips The default value is the only supported value.API name: ccs_minimize_roundtrips

func (*Submit)Collapseadded inv8.9.0

func (r *Submit) Collapse(collapse *types.FieldCollapse) *Submit

API name: collapse

func (*Submit)DefaultOperator

func (r *Submit) DefaultOperator(defaultoperatoroperator.Operator) *Submit

DefaultOperator The default operator for query string query (AND or OR)API name: default_operator

func (*Submit)Df

func (r *Submit) Df(dfstring) *Submit

Df The field to use as default where no field prefix is given in the querystringAPI name: df

func (Submit)Do

func (rSubmit) Do(providedCtxcontext.Context) (*Response,error)

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

func (*Submit)DocvalueFields

func (r *Submit) DocvalueFields(docvaluefields ...types.FieldAndFormat) *Submit

DocvalueFields Array of wildcard (*) patterns. The request returns doc values for fieldnames matching these patterns in the hits.fields property of the response.API name: docvalue_fields

func (*Submit)ErrorTraceadded inv8.14.0

func (r *Submit) ErrorTrace(errortracebool) *Submit

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

func (*Submit)ExpandWildcards

func (r *Submit) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *Submit

ExpandWildcards Whether to expand wildcard expression to concrete indices that are open,closed or both.API name: expand_wildcards

func (*Submit)Explain

func (r *Submit) Explain(explainbool) *Submit

Explain If true, returns detailed information about score computation as part of ahit.API name: explain

func (*Submit)Extadded inv8.9.0

func (r *Submit) Ext(ext map[string]json.RawMessage) *Submit

Ext Configuration of search extensions defined by Elasticsearch plugins.API name: ext

func (*Submit)Fieldsadded inv8.9.0

func (r *Submit) Fields(fields ...types.FieldAndFormat) *Submit

Fields Array of wildcard (*) patterns. The request returns values for field namesmatching these patterns in the hits.fields property of the response.API name: fields

func (*Submit)FilterPathadded inv8.14.0

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

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

func (*Submit)From

func (r *Submit) From(fromint) *Submit

From Starting document offset. By default, you cannot page through more than10,000hits using the from and size parameters. To page through more hits, use thesearch_after parameter.API name: from

func (*Submit)Header

func (r *Submit) Header(key, valuestring) *Submit

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

func (*Submit)Highlightadded inv8.9.0

func (r *Submit) Highlight(highlight *types.Highlight) *Submit

API name: highlight

func (*Submit)HttpRequest

func (r *Submit) HttpRequest(ctxcontext.Context) (*http.Request,error)

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

func (*Submit)Humanadded inv8.14.0

func (r *Submit) Human(humanbool) *Submit

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 (*Submit)IgnoreThrottled

func (r *Submit) IgnoreThrottled(ignorethrottledbool) *Submit

IgnoreThrottled Whether specified concrete, expanded or aliased indices should be ignoredwhen throttledAPI name: ignore_throttled

func (*Submit)IgnoreUnavailable

func (r *Submit) IgnoreUnavailable(ignoreunavailablebool) *Submit

IgnoreUnavailable Whether specified concrete indices should be ignored when unavailable(missing or closed)API name: ignore_unavailable

func (*Submit)Index

func (r *Submit) Index(indexstring) *Submit

Index A comma-separated list of index names to search; use `_all` or empty stringto perform the operation on all indicesAPI Name: index

func (*Submit)IndicesBoostadded inv8.9.0

func (r *Submit) IndicesBoost(indicesboosts ...map[string]types.Float64) *Submit

IndicesBoost Boosts the _score of documents from specified indices.API name: indices_boost

func (*Submit)KeepAlive

func (r *Submit) KeepAlive(durationstring) *Submit

KeepAlive Specifies how long the async search needs to be available.Ongoing async searches and any saved search results are deleted after thisperiod.API name: keep_alive

func (*Submit)KeepOnCompletion

func (r *Submit) KeepOnCompletion(keeponcompletionbool) *Submit

KeepOnCompletion If `true`, results are stored for later retrieval when the search completeswithin the `wait_for_completion_timeout`.API name: keep_on_completion

func (*Submit)Knnadded inv8.9.0

func (r *Submit) Knn(knns ...types.KnnSearch) *Submit

Knn Defines the approximate kNN search to run.API name: knn

func (*Submit)Lenient

func (r *Submit) Lenient(lenientbool) *Submit

Lenient Specify whether format-based query failures (such as providing text to anumeric field) should be ignoredAPI name: lenient

func (*Submit)MaxConcurrentShardRequests

func (r *Submit) MaxConcurrentShardRequests(maxconcurrentshardrequestsstring) *Submit

MaxConcurrentShardRequests The number of concurrent shard requests per node this search executesconcurrently. This value should be used to limit the impact of the search onthe cluster in order to limit the number of concurrent shard requestsAPI name: max_concurrent_shard_requests

func (*Submit)MinScoreadded inv8.9.0

func (r *Submit) MinScore(minscoretypes.Float64) *Submit

MinScore Minimum _score for matching documents. Documents with a lower _score arenot included in search results and results collected by aggregations.API name: min_score

func (Submit)Performadded inv8.7.0

func (rSubmit) Perform(providedCtxcontext.Context) (*http.Response,error)

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

func (*Submit)Pitadded inv8.9.0

Pit Limits the search to a point in time (PIT). If you provide a PIT, youcannot specify an <index> in the request path.API name: pit

func (*Submit)PostFilteradded inv8.9.0

func (r *Submit) PostFilter(postfilter *types.Query) *Submit

API name: post_filter

func (*Submit)Preference

func (r *Submit) Preference(preferencestring) *Submit

Preference Specify the node or shard the operation should be performed on (default:random)API name: preference

func (*Submit)Prettyadded inv8.14.0

func (r *Submit) Pretty(prettybool) *Submit

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

func (*Submit)Profileadded inv8.9.0

func (r *Submit) Profile(profilebool) *Submit

API name: profile

func (*Submit)Q

func (r *Submit) Q(qstring) *Submit

Q Query in the Lucene query string syntaxAPI name: q

func (*Submit)Queryadded inv8.9.0

func (r *Submit) Query(query *types.Query) *Submit

Query Defines the search definition using the Query DSL.API name: query

func (*Submit)Raw

func (r *Submit) Raw(rawio.Reader) *Submit

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

func (*Submit)Request

func (r *Submit) Request(req *Request) *Submit

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

func (*Submit)RequestCache

func (r *Submit) RequestCache(requestcachebool) *Submit

RequestCache Specify if request cache should be used for this request or not, defaults totrueAPI name: request_cache

func (*Submit)Rescoreadded inv8.9.0

func (r *Submit) Rescore(rescores ...types.Rescore) *Submit

API name: rescore

func (*Submit)RestTotalHitsAsInt

func (r *Submit) RestTotalHitsAsInt(resttotalhitsasintbool) *Submit

RestTotalHitsAsInt Indicates whether hits.total should be rendered as an integer or an object inthe rest search responseAPI name: rest_total_hits_as_int

func (*Submit)Routing

func (r *Submit) Routing(routingstring) *Submit

Routing A comma-separated list of specific routing valuesAPI name: routing

func (*Submit)RuntimeMappingsadded inv8.9.0

func (r *Submit) RuntimeMappings(runtimefieldstypes.RuntimeFields) *Submit

RuntimeMappings Defines one or more runtime fields in the search request. These fields takeprecedence over mapped fields with the same name.API name: runtime_mappings

func (*Submit)ScriptFieldsadded inv8.9.0

func (r *Submit) ScriptFields(scriptfields map[string]types.ScriptField) *Submit

ScriptFields Retrieve a script evaluation (based on different fields) for each hit.API name: script_fields

func (*Submit)SearchAfteradded inv8.9.0

func (r *Submit) SearchAfter(sortresults ...types.FieldValue) *Submit

API name: search_after

func (*Submit)SearchType

func (r *Submit) SearchType(searchtypesearchtype.SearchType) *Submit

SearchType Search operation typeAPI name: search_type

func (*Submit)SeqNoPrimaryTerm

func (r *Submit) SeqNoPrimaryTerm(seqnoprimarytermbool) *Submit

SeqNoPrimaryTerm If true, returns sequence number and primary term of the last modificationof each hit. See Optimistic concurrency control.API name: seq_no_primary_term

func (*Submit)Size

func (r *Submit) Size(sizeint) *Submit

Size The number of hits to return. By default, you cannot page through morethan 10,000 hits using the from and size parameters. To page through morehits, use the search_after parameter.API name: size

func (*Submit)Sliceadded inv8.9.0

func (r *Submit) Slice(slice *types.SlicedScroll) *Submit

API name: slice

func (*Submit)Sort

func (r *Submit) Sort(sorts ...types.SortCombinations) *Submit

API name: sort

func (*Submit)SourceExcludes_

func (r *Submit) SourceExcludes_(fields ...string) *Submit

SourceExcludes_ A list of fields to exclude from the returned _source fieldAPI name: _source_excludes

func (*Submit)SourceIncludes_

func (r *Submit) SourceIncludes_(fields ...string) *Submit

SourceIncludes_ A list of fields to extract and return from the _source fieldAPI name: _source_includes

func (*Submit)Source_

func (r *Submit) Source_(sourceconfigtypes.SourceConfig) *Submit

Source_ Indicates which source fields are returned for matching documents. Thesefields are returned in the hits._source property of the search response.API name: _source

func (*Submit)Stats

func (r *Submit) Stats(stats ...string) *Submit

Stats Stats groups to associate with the search. Each group maintains a statisticsaggregation for its associated searches. You can retrieve these stats usingthe indices stats API.API name: stats

func (*Submit)StoredFields

func (r *Submit) StoredFields(fields ...string) *Submit

StoredFields List of stored fields to return as part of a hit. If no fields are specified,no stored fields are included in the response. If this field is specified,the _sourceparameter defaults to false. You can pass _source: true to return both sourcefieldsand stored fields in the search response.API name: stored_fields

func (*Submit)Suggestadded inv8.9.0

func (r *Submit) Suggest(suggest *types.Suggester) *Submit

API name: suggest

func (*Submit)SuggestField

func (r *Submit) SuggestField(fieldstring) *Submit

SuggestField Specifies which field to use for suggestions.API name: suggest_field

func (*Submit)SuggestMode

func (r *Submit) SuggestMode(suggestmodesuggestmode.SuggestMode) *Submit

SuggestMode Specify suggest modeAPI name: suggest_mode

func (*Submit)SuggestSize

func (r *Submit) SuggestSize(suggestsizestring) *Submit

SuggestSize How many suggestions to return in responseAPI name: suggest_size

func (*Submit)SuggestText

func (r *Submit) SuggestText(suggesttextstring) *Submit

SuggestText The source text for which the suggestions should be returned.API name: suggest_text

func (*Submit)TerminateAfter

func (r *Submit) TerminateAfter(terminateafterint64) *Submit

TerminateAfter Maximum number of documents to collect for each shard. If a query reachesthislimit, Elasticsearch terminates the query early. Elasticsearch collectsdocumentsbefore sorting. Defaults to 0, which does not terminate query executionearly.API name: terminate_after

func (*Submit)Timeout

func (r *Submit) Timeout(timeoutstring) *Submit

Timeout Specifies the period of time to wait for a response from each shard. If noresponseis received before the timeout expires, the request fails and returns anerror.Defaults to no timeout.API name: timeout

func (*Submit)TrackScores

func (r *Submit) TrackScores(trackscoresbool) *Submit

TrackScores If true, calculate and return document scores, even if the scores are notused for sorting.API name: track_scores

func (*Submit)TrackTotalHits

func (r *Submit) TrackTotalHits(trackhitstypes.TrackHits) *Submit

TrackTotalHits Number of hits matching the query to count accurately. If true, the exactnumber of hits is returned at the cost of some performance. If false, theresponse does not include the total number of hits matching the query.Defaults to 10,000 hits.API name: track_total_hits

func (*Submit)TypedKeys

func (r *Submit) TypedKeys(typedkeysbool) *Submit

TypedKeys Specify whether aggregation and suggester names should be prefixed by theirrespective types in the responseAPI name: typed_keys

func (*Submit)Version

func (r *Submit) Version(versionbool) *Submit

Version If true, returns document version as part of a hit.API name: version

func (*Submit)WaitForCompletionTimeout

func (r *Submit) WaitForCompletionTimeout(durationstring) *Submit

WaitForCompletionTimeout Blocks and waits until the search is completed up to a certain timeout.When the async search completes within the timeout, the response won’tinclude the ID as the results are not stored in the cluster.API name: wait_for_completion_timeout

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp