Documentation ¶
Overview ¶
Run a search application search. Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. Unspecified template parameters are assigned their default values if applicable.
Index ¶
- Variables
- type NewSearch
- type Request
- type Response
- type Search
- func (r Search) Do(providedCtx context.Context) (*Response, error)
- func (r *Search) ErrorTrace(errortrace bool) *Search
- func (r *Search) FilterPath(filterpaths ...string) *Search
- func (r *Search) Header(key, value string) *Search
- func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Search) Human(human bool) *Search
- func (r *Search) Params(params map[string]json.RawMessage) *Search
- func (r Search) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Search) Pretty(pretty bool) *Search
- func (r *Search) Raw(raw io.Reader) *Search
- func (r *Search) Request(req *Request) *Search
- func (r *Search) TypedKeys(typedkeys bool) *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 { // Params Query parameters specific to this request, which will override any defaults // specified in the template. Params map[string]json.RawMessage `json:"params,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"` }
Response holds the response body struct for the package search
func (*Response) UnmarshalJSON ¶
type Search ¶
type Search struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *Search
Run a search application search. Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. Unspecified template parameters are assigned their default values if applicable.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-application-search.html
func (Search) Do ¶
Do runs the request through the transport, handle the response and returns a search.Response
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) 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) 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) Params ¶ added in v8.9.0
func (r *Search) Params(params map[string]json.RawMessage) *Search
Params Query parameters specific to this request, which will override any defaults specified in the template. API name: params
func (Search) Perform ¶
Perform runs the http.Request through the provided transport and returns an http.Response.
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) Raw ¶
Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.