submit

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Executes a search request asynchronously.

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 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 map[string]types.RuntimeField `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

https://github.com/elastic/elasticsearch-specification/blob/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/async_search/submit/AsyncSearchSubmitRequest.ts#L55-L255

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

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

FromJSON allows to load an arbitrary json into the request structure

type Response

type Response struct {
	Response types.AsyncSearch `json:"response"`
}

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

type Submit

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

func (*Submit) AllowNoIndices

func (r *Submit) AllowNoIndices(b bool) *Submit

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

func (r *Submit) AllowPartialSearchResults(b bool) *Submit

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

func (r *Submit) AnalyzeWildcard(b bool) *Submit

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

func (*Submit) Analyzer

func (r *Submit) Analyzer(v string) *Submit

Analyzer The analyzer to use for the query string API name: analyzer

func (*Submit) BatchedReduceSize

func (r *Submit) BatchedReduceSize(v string) *Submit

BatchedReduceSize The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available. API name: batched_reduce_size

func (*Submit) CcsMinimizeRoundtrips

func (r *Submit) CcsMinimizeRoundtrips(b bool) *Submit

API name: ccs_minimize_roundtrips

func (*Submit) DefaultOperator

func (r *Submit) DefaultOperator(enum operator.Operator) *Submit

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

func (*Submit) Df

func (r *Submit) Df(v string) *Submit

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

func (Submit) Do

func (r Submit) Do(ctx context.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(v string) *Submit

DocvalueFields A comma-separated list of fields to return as the docvalue representation of a field for each hit API name: docvalue_fields

func (*Submit) ExpandWildcards

func (r *Submit) ExpandWildcards(v string) *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(b bool) *Submit

Explain Specify whether to return detailed information about score computation as part of a hit API name: explain

func (*Submit) From

func (r *Submit) From(i int) *Submit

From Starting offset (default: 0) API name: from

func (*Submit) Header

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

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

func (*Submit) HttpRequest

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

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

func (*Submit) IgnoreThrottled

func (r *Submit) IgnoreThrottled(b bool) *Submit

IgnoreThrottled Whether specified concrete, expanded or aliased indices should be ignored when throttled API name: ignore_throttled

func (*Submit) IgnoreUnavailable

func (r *Submit) IgnoreUnavailable(b bool) *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(v string) *Submit

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) KeepAlive

func (r *Submit) KeepAlive(v string) *Submit

KeepAlive Update the time interval in which the results (partial or final) for this search will be available API name: keep_alive

func (*Submit) KeepOnCompletion

func (r *Submit) KeepOnCompletion(b bool) *Submit

KeepOnCompletion Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) API name: keep_on_completion

func (*Submit) Lenient

func (r *Submit) Lenient(b bool) *Submit

Lenient Specify whether format-based query failures (such as providing text to a numeric field) should be ignored API name: lenient

func (*Submit) MaxConcurrentShardRequests

func (r *Submit) MaxConcurrentShardRequests(v string) *Submit

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

func (r *Submit) MinCompatibleShardNode(v string) *Submit

API name: min_compatible_shard_node

func (Submit) Perform

func (r Submit) Perform(ctx context.Context) (*http.Response, error)

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

func (*Submit) PreFilterShardSize

func (r *Submit) PreFilterShardSize(v string) *Submit

API name: pre_filter_shard_size

func (*Submit) Preference

func (r *Submit) Preference(v string) *Submit

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

func (*Submit) Q

func (r *Submit) Q(v string) *Submit

Q Query in the Lucene query string syntax API name: q

func (*Submit) Raw

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

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

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

func (*Submit) RestTotalHitsAsInt

func (r *Submit) RestTotalHitsAsInt(b bool) *Submit

API name: rest_total_hits_as_int

func (*Submit) Routing

func (r *Submit) Routing(v string) *Submit

Routing A comma-separated list of specific routing values API name: routing

func (*Submit) Scroll

func (r *Submit) Scroll(v string) *Submit

API name: scroll

func (*Submit) SearchType

func (r *Submit) SearchType(enum searchtype.SearchType) *Submit

SearchType Search operation type API name: search_type

func (*Submit) SeqNoPrimaryTerm

func (r *Submit) SeqNoPrimaryTerm(b bool) *Submit

SeqNoPrimaryTerm Specify whether to return sequence number and primary term of the last modification of each hit API name: seq_no_primary_term

func (*Submit) Size

func (r *Submit) Size(i int) *Submit

Size Number of hits to return (default: 10) API name: size

func (*Submit) Sort

func (r *Submit) Sort(v string) *Submit

Sort A comma-separated list of <field>:<direction> pairs API name: sort

func (*Submit) SourceExcludes_

func (r *Submit) SourceExcludes_(v string) *Submit

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

func (*Submit) SourceIncludes_

func (r *Submit) SourceIncludes_(v string) *Submit

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

func (*Submit) Source_

func (r *Submit) Source_(v string) *Submit

Source_ True or false to return the _source field or not, or a list of fields to return API name: _source

func (*Submit) Stats

func (r *Submit) Stats(v string) *Submit

Stats Specific 'tag' of the request for logging and statistical purposes API name: stats

func (*Submit) StoredFields

func (r *Submit) StoredFields(v string) *Submit

StoredFields A comma-separated list of stored fields to return as part of a hit API name: stored_fields

func (*Submit) SuggestField

func (r *Submit) SuggestField(v string) *Submit

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

func (*Submit) SuggestMode

func (r *Submit) SuggestMode(enum suggestmode.SuggestMode) *Submit

SuggestMode Specify suggest mode API name: suggest_mode

func (*Submit) SuggestSize

func (r *Submit) SuggestSize(v string) *Submit

SuggestSize How many suggestions to return in response API name: suggest_size

func (*Submit) SuggestText

func (r *Submit) SuggestText(v string) *Submit

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

func (*Submit) TerminateAfter

func (r *Submit) TerminateAfter(v string) *Submit

TerminateAfter The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. API name: terminate_after

func (*Submit) Timeout

func (r *Submit) Timeout(v string) *Submit

Timeout Explicit operation timeout API name: timeout

func (*Submit) TrackScores

func (r *Submit) TrackScores(b bool) *Submit

TrackScores Whether to calculate and return scores even if they are not used for sorting API name: track_scores

func (*Submit) TrackTotalHits

func (r *Submit) TrackTotalHits(v string) *Submit

TrackTotalHits Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. API name: track_total_hits

func (*Submit) TypedKeys

func (r *Submit) TypedKeys(b bool) *Submit

TypedKeys Specify whether aggregation and suggester names should be prefixed by their respective types in the response API name: typed_keys

func (*Submit) Version

func (r *Submit) Version(b bool) *Submit

Version Specify whether to return document version as part of a hit API name: version

func (*Submit) WaitForCompletionTimeout

func (r *Submit) WaitForCompletionTimeout(v string) *Submit

WaitForCompletionTimeout Specify the time that the request should block waiting for the final response API name: wait_for_completion_timeout

Jump to

Keyboard shortcuts

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