Documentation ¶
Overview ¶
Perform a search against a search application
Index ¶
- Variables
- type NewSearch
- type Request
- type Response
- type Search
- func (r Search) Do(providedCtx context.Context) (*Response, error)
- func (r *Search) Header(key, value string) *Search
- func (r *Search) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Search) Params(params map[string]json.RawMessage) *Search
- func (r Search) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Search) Raw(raw io.Reader) *Search
- func (r *Search) Request(req *Request) *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
Perform a search against a search application
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) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*Search) Params ¶
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.