Documentation ¶
Overview ¶
Executes a search request asynchronously.
Index ¶
- Variables
- type NewSubmit
- type Request
- type Response
- type Submit
- func (r *Submit) Aggregations(aggregations map[string]types.Aggregations) *Submit
- func (r *Submit) AllowNoIndices(allownoindices bool) *Submit
- func (r *Submit) AllowPartialSearchResults(allowpartialsearchresults bool) *Submit
- func (r *Submit) AnalyzeWildcard(analyzewildcard bool) *Submit
- func (r *Submit) Analyzer(analyzer string) *Submit
- func (r *Submit) BatchedReduceSize(batchedreducesize string) *Submit
- func (r *Submit) CcsMinimizeRoundtrips(ccsminimizeroundtrips bool) *Submit
- func (r *Submit) Collapse(collapse *types.FieldCollapse) *Submit
- func (r *Submit) DefaultOperator(defaultoperator operator.Operator) *Submit
- func (r *Submit) Df(df string) *Submit
- func (r Submit) Do(ctx context.Context) (*Response, error)
- func (r *Submit) DocvalueFields(docvaluefields ...types.FieldAndFormat) *Submit
- func (r *Submit) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *Submit
- func (r *Submit) Explain(explain bool) *Submit
- func (r *Submit) Ext(ext map[string]json.RawMessage) *Submit
- func (r *Submit) Fields(fields ...types.FieldAndFormat) *Submit
- func (r *Submit) From(from int) *Submit
- func (r *Submit) Header(key, value string) *Submit
- func (r *Submit) Highlight(highlight *types.Highlight) *Submit
- func (r *Submit) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Submit) IgnoreThrottled(ignorethrottled bool) *Submit
- func (r *Submit) IgnoreUnavailable(ignoreunavailable bool) *Submit
- func (r *Submit) Index(index string) *Submit
- func (r *Submit) IndicesBoost(indicesboosts ...map[string]types.Float64) *Submit
- func (r *Submit) KeepAlive(duration string) *Submit
- func (r *Submit) KeepOnCompletion(keeponcompletion bool) *Submit
- func (r *Submit) Knn(knns ...types.KnnQuery) *Submit
- func (r *Submit) Lenient(lenient bool) *Submit
- func (r *Submit) MaxConcurrentShardRequests(maxconcurrentshardrequests string) *Submit
- func (r *Submit) MinCompatibleShardNode(versionstring string) *Submit
- func (r *Submit) MinScore(minscore types.Float64) *Submit
- func (r Submit) Perform(ctx context.Context) (*http.Response, error)
- func (r *Submit) Pit(pit *types.PointInTimeReference) *Submit
- func (r *Submit) PostFilter(postfilter *types.Query) *Submit
- func (r *Submit) PreFilterShardSize(prefiltershardsize string) *Submit
- func (r *Submit) Preference(preference string) *Submit
- func (r *Submit) Profile(profile bool) *Submit
- func (r *Submit) Q(q string) *Submit
- func (r *Submit) Query(query *types.Query) *Submit
- func (r *Submit) Raw(raw io.Reader) *Submit
- func (r *Submit) Request(req *Request) *Submit
- func (r *Submit) RequestCache(requestcache bool) *Submit
- func (r *Submit) Rescore(rescores ...types.Rescore) *Submit
- func (r *Submit) RestTotalHitsAsInt(resttotalhitsasint bool) *Submit
- func (r *Submit) Routing(routing string) *Submit
- func (r *Submit) RuntimeMappings(runtimefields types.RuntimeFields) *Submit
- func (r *Submit) ScriptFields(scriptfields map[string]types.ScriptField) *Submit
- func (r *Submit) Scroll(duration string) *Submit
- func (r *Submit) SearchAfter(sortresults ...types.FieldValue) *Submit
- func (r *Submit) SearchType(searchtype searchtype.SearchType) *Submit
- func (r *Submit) SeqNoPrimaryTerm(seqnoprimaryterm bool) *Submit
- func (r *Submit) Size(size int) *Submit
- func (r *Submit) Slice(slice *types.SlicedScroll) *Submit
- func (r *Submit) Sort(sorts ...types.SortCombinations) *Submit
- func (r *Submit) SourceExcludes_(fields ...string) *Submit
- func (r *Submit) SourceIncludes_(fields ...string) *Submit
- func (r *Submit) Source_(sourceconfig types.SourceConfig) *Submit
- func (r *Submit) Stats(stats ...string) *Submit
- func (r *Submit) StoredFields(fields ...string) *Submit
- func (r *Submit) Suggest(suggest *types.Suggester) *Submit
- func (r *Submit) SuggestField(field string) *Submit
- func (r *Submit) SuggestMode(suggestmode suggestmode.SuggestMode) *Submit
- func (r *Submit) SuggestSize(suggestsize string) *Submit
- func (r *Submit) SuggestText(suggesttext string) *Submit
- func (r *Submit) TerminateAfter(terminateafter int64) *Submit
- func (r *Submit) Timeout(timeout string) *Submit
- func (r *Submit) TrackScores(trackscores bool) *Submit
- func (r *Submit) TrackTotalHits(trackhits types.TrackHits) *Submit
- func (r *Submit) TypedKeys(typedkeys bool) *Submit
- func (r *Submit) Version(version bool) *Submit
- func (r *Submit) WaitForCompletionTimeout(duration string) *Submit
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 ¶
type NewSubmit ¶
type NewSubmit func() *Submit
NewSubmit type alias for index.
func NewSubmitFunc ¶
func NewSubmitFunc(tp elastictransport.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.
type Request ¶
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.KnnQuery `json:"knn,omitempty"` // MinScore Minimum _score for matching documents. Documents with a lower _score are // not included in the search results. 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. RuntimeMappings types.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. TrackTotalHits types.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
type Response ¶ added in v8.7.0
type Response struct { // ExpirationTime Indicates when the async search will expire. ExpirationTime types.DateTime `json:"expiration_time,omitempty"` ExpirationTimeInMillis int64 `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`. IsPartial bool `json:"is_partial"` // IsRunning Indicates whether the search is still running or has completed. // NOTE: 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`. IsRunning bool `json:"is_running"` Response types.AsyncSearch `json:"response"` StartTime types.DateTime `json:"start_time,omitempty"` StartTimeInMillis int64 `json:"start_time_in_millis"` }
type Submit ¶
type Submit struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *Submit
Executes a search request asynchronously.
https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/async-search.html
func (*Submit) Aggregations ¶ added in v8.9.0
func (r *Submit) Aggregations(aggregations map[string]types.Aggregations) *Submit
API name: aggregations
func (*Submit) AllowNoIndices ¶
AllowNoIndices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) API name: allow_no_indices
func (*Submit) AllowPartialSearchResults ¶
AllowPartialSearchResults Indicate if an error should be returned if there is a partial search failure or timeout API name: allow_partial_search_results
func (*Submit) AnalyzeWildcard ¶
AnalyzeWildcard Specify whether wildcard and prefix queries should be analyzed (default: false) API name: analyze_wildcard
func (*Submit) BatchedReduceSize ¶
BatchedReduceSize Affects how often partial results become available, which happens whenever shard results are reduced. A partial reduction is performed every time the coordinating node has received a certain number of new shard responses (5 by default). API name: batched_reduce_size
func (*Submit) CcsMinimizeRoundtrips ¶
CcsMinimizeRoundtrips The default value is the only supported value. API name: ccs_minimize_roundtrips
func (*Submit) Collapse ¶ added in v8.9.0
func (r *Submit) Collapse(collapse *types.FieldCollapse) *Submit
API name: collapse
func (*Submit) DefaultOperator ¶
DefaultOperator The default operator for query string query (AND or OR) API name: default_operator
func (*Submit) Df ¶
Df The field to use as default where no field prefix is given in the query string API name: df
func (Submit) Do ¶
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 field names matching these patterns in the hits.fields property of the response. API name: docvalue_fields
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 ¶
Explain If true, returns detailed information about score computation as part of a hit. API name: explain
func (*Submit) Ext ¶ added in v8.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) Fields ¶ added in v8.9.0
func (r *Submit) Fields(fields ...types.FieldAndFormat) *Submit
Fields Array of wildcard (*) patterns. The request returns values for field names matching these patterns in the hits.fields property of the response. API name: fields
func (*Submit) From ¶
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. API name: from
func (*Submit) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*Submit) IgnoreThrottled ¶
IgnoreThrottled Whether specified concrete, expanded or aliased indices should be ignored when throttled API name: ignore_throttled
func (*Submit) IgnoreUnavailable ¶
IgnoreUnavailable Whether specified concrete indices should be ignored when unavailable (missing or closed) API name: ignore_unavailable
func (*Submit) Index ¶
Index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices API Name: index
func (*Submit) IndicesBoost ¶ added in v8.9.0
IndicesBoost Boosts the _score of documents from specified indices. API name: indices_boost
func (*Submit) KeepAlive ¶
KeepAlive Specifies how long the async search needs to be available. Ongoing async searches and any saved search results are deleted after this period. API name: keep_alive
func (*Submit) KeepOnCompletion ¶
KeepOnCompletion If `true`, results are stored for later retrieval when the search completes within the `wait_for_completion_timeout`. API name: keep_on_completion
func (*Submit) Lenient ¶
Lenient Specify whether format-based query failures (such as providing text to a numeric field) should be ignored API name: lenient
func (*Submit) MaxConcurrentShardRequests ¶
MaxConcurrentShardRequests The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests API name: max_concurrent_shard_requests
func (*Submit) MinCompatibleShardNode ¶
API name: min_compatible_shard_node
func (*Submit) MinScore ¶ added in v8.9.0
MinScore Minimum _score for matching documents. Documents with a lower _score are not included in the search results. API name: min_score
func (Submit) Perform ¶ added in v8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Submit) Pit ¶ added in v8.9.0
func (r *Submit) Pit(pit *types.PointInTimeReference) *Submit
Pit Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an <index> in the request path. API name: pit
func (*Submit) PostFilter ¶ added in v8.9.0
API name: post_filter
func (*Submit) PreFilterShardSize ¶
PreFilterShardSize The default value cannot be changed, which enforces the execution of a pre-filter roundtrip to retrieve statistics from each shard so that the ones that surely don’t hold any document matching the query get skipped. API name: pre_filter_shard_size
func (*Submit) Preference ¶
Preference Specify the node or shard the operation should be performed on (default: random) API name: preference
func (*Submit) Query ¶ added in v8.9.0
Query Defines the search definition using the Query DSL. API name: query
func (*Submit) Raw ¶
Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.
func (*Submit) RequestCache ¶
RequestCache Specify if request cache should be used for this request or not, defaults to true API name: request_cache
func (*Submit) RestTotalHitsAsInt ¶
API name: rest_total_hits_as_int
func (*Submit) Routing ¶
Routing A comma-separated list of specific routing values API name: routing
func (*Submit) RuntimeMappings ¶ added in v8.9.0
func (r *Submit) RuntimeMappings(runtimefields types.RuntimeFields) *Submit
RuntimeMappings Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. API name: runtime_mappings
func (*Submit) ScriptFields ¶ added in v8.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) SearchAfter ¶ added in v8.9.0
func (r *Submit) SearchAfter(sortresults ...types.FieldValue) *Submit
API name: search_after
func (*Submit) SearchType ¶
func (r *Submit) SearchType(searchtype searchtype.SearchType) *Submit
SearchType Search operation type API name: search_type
func (*Submit) SeqNoPrimaryTerm ¶
SeqNoPrimaryTerm If true, returns sequence number and primary term of the last modification of each hit. See Optimistic concurrency control. API name: seq_no_primary_term
func (*Submit) Size ¶
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. API name: size
func (*Submit) Slice ¶ added in v8.9.0
func (r *Submit) Slice(slice *types.SlicedScroll) *Submit
API name: slice
func (*Submit) SourceExcludes_ ¶
SourceExcludes_ A list of fields to exclude from the returned _source field API name: _source_excludes
func (*Submit) SourceIncludes_ ¶
SourceIncludes_ A list of fields to extract and return from the _source field API name: _source_includes
func (*Submit) Source_ ¶
func (r *Submit) Source_(sourceconfig types.SourceConfig) *Submit
Source_ Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response. API name: _source
func (*Submit) Stats ¶
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. API name: stats
func (*Submit) StoredFields ¶
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. API name: stored_fields
func (*Submit) SuggestField ¶
SuggestField Specifies which field to use for suggestions. API name: suggest_field
func (*Submit) SuggestMode ¶
func (r *Submit) SuggestMode(suggestmode suggestmode.SuggestMode) *Submit
SuggestMode Specify suggest mode API name: suggest_mode
func (*Submit) SuggestSize ¶
SuggestSize How many suggestions to return in response API name: suggest_size
func (*Submit) SuggestText ¶
SuggestText The source text for which the suggestions should be returned. API name: suggest_text
func (*Submit) TerminateAfter ¶
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. API name: terminate_after
func (*Submit) Timeout ¶
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. API name: timeout
func (*Submit) TrackScores ¶
TrackScores If true, calculate and return document scores, even if the scores are not used for sorting. API name: track_scores
func (*Submit) TrackTotalHits ¶
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. API name: track_total_hits
func (*Submit) TypedKeys ¶
TypedKeys Specify whether aggregation and suggester names should be prefixed by their respective types in the response API name: typed_keys
func (*Submit) Version ¶
Version If true, returns document version as part of a hit. API name: version
func (*Submit) WaitForCompletionTimeout ¶
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’t include the ID as the results are not stored in the cluster. API name: wait_for_completion_timeout