Documentation
¶
Overview ¶
Search API where the search will only be executed after specified checkpoints are available due to a refresh. This API is designed for internal use by the fleet server project.
Index ¶
- Variables
- type NewSearch
- type Request
- type Response
- type Search
- func (r *Search) AllowNoIndices(b bool) *Search
- func (r *Search) AllowPartialSearchResults(b bool) *Search
- func (r *Search) AnalyzeWildcard(b bool) *Search
- func (r *Search) Analyzer(v string) *Search
- func (r *Search) BatchedReduceSize(v string) *Search
- func (r *Search) CcsMinimizeRoundtrips(b bool) *Search
- func (r *Search) DefaultOperator(enum operator.Operator) *Search
- func (r *Search) Df(v string) *Search
- func (r Search) Do(ctx context.Context) (*Response, error)
- func (r *Search) DocvalueFields(v string) *Search
- func (r *Search) ExpandWildcards(v string) *Search
- func (r *Search) Explain(b bool) *Search
- func (r *Search) From(i int) *Search
- func (r *Search) Header(key, value string) *Search
- func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Search) IgnoreThrottled(b bool) *Search
- func (r *Search) IgnoreUnavailable(b bool) *Search
- func (r *Search) Index(v string) *Search
- func (r *Search) Lenient(b bool) *Search
- func (r *Search) MaxConcurrentShardRequests(v string) *Search
- func (r *Search) MinCompatibleShardNode(v string) *Search
- func (r Search) Perform(ctx context.Context) (*http.Response, error)
- func (r *Search) PreFilterShardSize(v string) *Search
- func (r *Search) Preference(v string) *Search
- func (r *Search) Q(v string) *Search
- func (r *Search) Raw(raw io.Reader) *Search
- func (r *Search) Request(req *Request) *Search
- func (r *Search) RequestCache(b bool) *Search
- func (r *Search) RestTotalHitsAsInt(b bool) *Search
- func (r *Search) Routing(v string) *Search
- func (r *Search) Scroll(v string) *Search
- func (r *Search) SearchType(enum searchtype.SearchType) *Search
- func (r *Search) SeqNoPrimaryTerm(b bool) *Search
- func (r *Search) Size(i int) *Search
- func (r *Search) Sort(v string) *Search
- func (r *Search) SourceExcludes_(v string) *Search
- func (r *Search) SourceIncludes_(v string) *Search
- func (r *Search) Source_(v string) *Search
- func (r *Search) Stats(v string) *Search
- func (r *Search) StoredFields(v string) *Search
- func (r *Search) SuggestField(v string) *Search
- func (r *Search) SuggestMode(enum suggestmode.SuggestMode) *Search
- func (r *Search) SuggestSize(v string) *Search
- func (r *Search) SuggestText(v string) *Search
- func (r *Search) TerminateAfter(v string) *Search
- func (r *Search) Timeout(v string) *Search
- func (r *Search) TrackScores(b bool) *Search
- func (r *Search) TrackTotalHits(v string) *Search
- func (r *Search) TypedKeys(b bool) *Search
- func (r *Search) Version(b bool) *Search
- func (r *Search) WaitForCheckpoints(v string) *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 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 search
type Response ¶
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"`
}
func (*Response) UnmarshalJSON ¶
type Search ¶
type Search struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *Search
Search API where the search will only be executed after specified checkpoints are available due to a refresh. This API is designed for internal use by the fleet server project.
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) 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 ¶
API name: docvalue_fields
func (*Search) ExpandWildcards ¶
API name: expand_wildcards
func (*Search) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*Search) IgnoreThrottled ¶
API name: ignore_throttled
func (*Search) IgnoreUnavailable ¶
API name: ignore_unavailable
func (*Search) Index ¶
Index A single target to search. If the target is an index alias, it must resolve to a single index. API Name: index
func (*Search) MaxConcurrentShardRequests ¶
API name: max_concurrent_shard_requests
func (*Search) MinCompatibleShardNode ¶
API name: min_compatible_shard_node
func (Search) Perform ¶
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Search) PreFilterShardSize ¶
API name: pre_filter_shard_size
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) RestTotalHitsAsInt ¶
API name: rest_total_hits_as_int
func (*Search) SearchType ¶
func (r *Search) SearchType(enum searchtype.SearchType) *Search
API name: search_type
func (*Search) SeqNoPrimaryTerm ¶
API name: seq_no_primary_term
func (*Search) SourceExcludes_ ¶
API name: _source_excludes
func (*Search) SourceIncludes_ ¶
API name: _source_includes
func (*Search) StoredFields ¶
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(enum suggestmode.SuggestMode) *Search
API name: suggest_mode
func (*Search) SuggestText ¶
SuggestText The source text for which the suggestions should be returned. API name: suggest_text
func (*Search) TerminateAfter ¶
API name: terminate_after
func (*Search) TrackTotalHits ¶
API name: track_total_hits
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