Documentation ¶
Overview ¶
The purpose of the fleet search api is to provide a search api where the search will only be executed after provided checkpoint has been processed and is visible for searches inside of Elasticsearch.
Index ¶
- Variables
- type NewSearch
- type Request
- type Response
- type Search
- func (r *Search) Aggregations(aggregations map[string]types.Aggregations) *Search
- func (r *Search) AllowNoIndices(allownoindices bool) *Search
- func (r *Search) AllowPartialSearchResults(allowpartialsearchresults bool) *Search
- func (r *Search) AnalyzeWildcard(analyzewildcard bool) *Search
- func (r *Search) Analyzer(analyzer string) *Search
- func (r *Search) BatchedReduceSize(batchedreducesize string) *Search
- func (r *Search) CcsMinimizeRoundtrips(ccsminimizeroundtrips bool) *Search
- func (r *Search) Collapse(collapse *types.FieldCollapse) *Search
- func (r *Search) DefaultOperator(defaultoperator operator.Operator) *Search
- func (r *Search) Df(df string) *Search
- func (r Search) Do(providedCtx context.Context) (*Response, error)
- func (r *Search) DocvalueFields(docvaluefields ...types.FieldAndFormat) *Search
- func (r *Search) ErrorTrace(errortrace bool) *Search
- func (r *Search) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *Search
- func (r *Search) Explain(explain bool) *Search
- func (r *Search) Ext(ext map[string]json.RawMessage) *Search
- func (r *Search) Fields(fields ...types.FieldAndFormat) *Search
- func (r *Search) FilterPath(filterpaths ...string) *Search
- func (r *Search) From(from int) *Search
- func (r *Search) Header(key, value string) *Search
- func (r *Search) Highlight(highlight *types.Highlight) *Search
- func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Search) Human(human bool) *Search
- func (r *Search) IgnoreThrottled(ignorethrottled bool) *Search
- func (r *Search) IgnoreUnavailable(ignoreunavailable bool) *Search
- func (r *Search) IndicesBoost(indicesboosts ...map[string]types.Float64) *Search
- func (r *Search) Lenient(lenient bool) *Search
- func (r *Search) MaxConcurrentShardRequests(maxconcurrentshardrequests string) *Search
- func (r *Search) MinCompatibleShardNode(versionstring string) *Search
- func (r *Search) MinScore(minscore types.Float64) *Search
- func (r Search) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Search) Pit(pit *types.PointInTimeReference) *Search
- func (r *Search) PostFilter(postfilter *types.Query) *Search
- func (r *Search) PreFilterShardSize(prefiltershardsize string) *Search
- func (r *Search) Preference(preference string) *Search
- func (r *Search) Pretty(pretty bool) *Search
- func (r *Search) Profile(profile bool) *Search
- func (r *Search) Q(q string) *Search
- func (r *Search) Query(query *types.Query) *Search
- func (r *Search) Raw(raw io.Reader) *Search
- func (r *Search) Request(req *Request) *Search
- func (r *Search) RequestCache(requestcache bool) *Search
- func (r *Search) Rescore(rescores ...types.Rescore) *Search
- func (r *Search) RestTotalHitsAsInt(resttotalhitsasint bool) *Search
- func (r *Search) Routing(routing string) *Search
- func (r *Search) RuntimeMappings(runtimefields types.RuntimeFields) *Search
- func (r *Search) ScriptFields(scriptfields map[string]types.ScriptField) *Search
- func (r *Search) Scroll(duration string) *Search
- func (r *Search) SearchAfter(sortresults ...types.FieldValue) *Search
- func (r *Search) SearchType(searchtype searchtype.SearchType) *Search
- func (r *Search) SeqNoPrimaryTerm(seqnoprimaryterm bool) *Search
- func (r *Search) Size(size int) *Search
- func (r *Search) Slice(slice *types.SlicedScroll) *Search
- func (r *Search) Sort(sorts ...types.SortCombinations) *Search
- func (r *Search) SourceExcludes_(fields ...string) *Search
- func (r *Search) SourceIncludes_(fields ...string) *Search
- func (r *Search) Source_(sourceconfig types.SourceConfig) *Search
- func (r *Search) Stats(stats ...string) *Search
- func (r *Search) StoredFields(fields ...string) *Search
- func (r *Search) Suggest(suggest *types.Suggester) *Search
- func (r *Search) SuggestField(field string) *Search
- func (r *Search) SuggestMode(suggestmode suggestmode.SuggestMode) *Search
- func (r *Search) SuggestSize(suggestsize string) *Search
- func (r *Search) SuggestText(suggesttext string) *Search
- func (r *Search) TerminateAfter(terminateafter int64) *Search
- func (r *Search) Timeout(timeout string) *Search
- func (r *Search) TrackScores(trackscores bool) *Search
- func (r *Search) TrackTotalHits(trackhits types.TrackHits) *Search
- func (r *Search) TypedKeys(typedkeys bool) *Search
- func (r *Search) Version(version bool) *Search
- func (r *Search) WaitForCheckpoints(waitforcheckpoints ...int64) *Search
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 NewSearch ¶
NewSearch type alias for index.
func NewSearchFunc ¶
func NewSearchFunc(tp elastictransport.Interface) NewSearch
NewSearchFunc returns a new instance of Search 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"` // 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 search
func (*Request) FromJSON ¶ added in v8.5.0
FromJSON allows to load an arbitrary json into the request structure
func (*Request) UnmarshalJSON ¶ added in v8.12.1
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 search
func (*Response) UnmarshalJSON ¶ added in v8.7.0
type Search ¶
type Search struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *Search
The purpose of the fleet search api is to provide a search api where the search will only be executed after provided checkpoint has been processed and is visible for searches inside of Elasticsearch.
func (*Search) Aggregations ¶ added in v8.9.0
func (r *Search) Aggregations(aggregations map[string]types.Aggregations) *Search
API name: aggregations
func (*Search) AllowNoIndices ¶
API name: allow_no_indices
func (*Search) AllowPartialSearchResults ¶
AllowPartialSearchResults If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns an error with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results` which is true by default. API name: allow_partial_search_results
func (*Search) AnalyzeWildcard ¶
API name: analyze_wildcard
func (*Search) BatchedReduceSize ¶
API name: batched_reduce_size
func (*Search) CcsMinimizeRoundtrips ¶
API name: ccs_minimize_roundtrips
func (*Search) Collapse ¶ added in v8.9.0
func (r *Search) Collapse(collapse *types.FieldCollapse) *Search
API name: collapse
func (*Search) DefaultOperator ¶
API name: default_operator
func (Search) Do ¶
Do runs the request through the transport, handle the response and returns a search.Response
func (*Search) DocvalueFields ¶
func (r *Search) DocvalueFields(docvaluefields ...types.FieldAndFormat) *Search
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 (*Search) ErrorTrace ¶ added in v8.14.0
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace
func (*Search) ExpandWildcards ¶
func (r *Search) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *Search
API name: expand_wildcards
func (*Search) Explain ¶
Explain If true, returns detailed information about score computation as part of a hit. API name: explain
func (*Search) Ext ¶ added in v8.9.0
func (r *Search) Ext(ext map[string]json.RawMessage) *Search
Ext Configuration of search extensions defined by Elasticsearch plugins. API name: ext
func (*Search) Fields ¶ added in v8.9.0
func (r *Search) Fields(fields ...types.FieldAndFormat) *Search
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 (*Search) FilterPath ¶ added in v8.14.0
FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path
func (*Search) 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 (*Search) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*Search) Human ¶ added in v8.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 human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human
func (*Search) IgnoreThrottled ¶
API name: ignore_throttled
func (*Search) IgnoreUnavailable ¶
API name: ignore_unavailable
func (*Search) IndicesBoost ¶ added in v8.9.0
IndicesBoost Boosts the _score of documents from specified indices. API name: indices_boost
func (*Search) MaxConcurrentShardRequests ¶
API name: max_concurrent_shard_requests
func (*Search) MinCompatibleShardNode ¶
API name: min_compatible_shard_node
func (*Search) 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 (Search) Perform ¶ added in v8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Search) Pit ¶ added in v8.9.0
func (r *Search) Pit(pit *types.PointInTimeReference) *Search
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 (*Search) PostFilter ¶ added in v8.9.0
API name: post_filter
func (*Search) PreFilterShardSize ¶
API name: pre_filter_shard_size
func (*Search) Preference ¶
API name: preference
func (*Search) Pretty ¶ added in v8.14.0
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty
func (*Search) Query ¶ added in v8.9.0
Query Defines the search definition using the Query DSL. API name: query
func (*Search) 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 (*Search) RequestCache ¶
API name: request_cache
func (*Search) RestTotalHitsAsInt ¶
API name: rest_total_hits_as_int
func (*Search) RuntimeMappings ¶ added in v8.9.0
func (r *Search) RuntimeMappings(runtimefields types.RuntimeFields) *Search
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 (*Search) ScriptFields ¶ added in v8.9.0
func (r *Search) ScriptFields(scriptfields map[string]types.ScriptField) *Search
ScriptFields Retrieve a script evaluation (based on different fields) for each hit. API name: script_fields
func (*Search) SearchAfter ¶ added in v8.9.0
func (r *Search) SearchAfter(sortresults ...types.FieldValue) *Search
API name: search_after
func (*Search) SearchType ¶
func (r *Search) SearchType(searchtype searchtype.SearchType) *Search
API name: search_type
func (*Search) 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 (*Search) 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 (*Search) Slice ¶ added in v8.9.0
func (r *Search) Slice(slice *types.SlicedScroll) *Search
API name: slice
func (*Search) SourceExcludes_ ¶
API name: _source_excludes
func (*Search) SourceIncludes_ ¶
API name: _source_includes
func (*Search) Source_ ¶
func (r *Search) Source_(sourceconfig types.SourceConfig) *Search
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 (*Search) 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 (*Search) 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 (*Search) SuggestField ¶
SuggestField Specifies which field to use for suggestions. API name: suggest_field
func (*Search) SuggestMode ¶
func (r *Search) SuggestMode(suggestmode suggestmode.SuggestMode) *Search
API name: suggest_mode
func (*Search) SuggestSize ¶
API name: suggest_size
func (*Search) SuggestText ¶
SuggestText The source text for which the suggestions should be returned. API name: suggest_text
func (*Search) 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 (*Search) 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 (*Search) TrackScores ¶
TrackScores If true, calculate and return document scores, even if the scores are not used for sorting. API name: track_scores
func (*Search) 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 (*Search) Version ¶
Version If true, returns document version as part of a hit. API name: version
func (*Search) WaitForCheckpoints ¶
WaitForCheckpoints A comma separated list of checkpoints. When configured, the search API will only be executed on a shard after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause Elasticsearch to immediately execute the search. API name: wait_for_checkpoints