count
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Count search results.Get the number of documents matching a query.
The query can be provided either by using a simple query string as aparameter, or by defining Query DSL within the request body.The query is optional. When no query is provided, the API uses `match_all` tocount all the documents.
The count API supports multi-target syntax. You can run a single count APIsearch across multiple data streams and indices.
The operation is broadcast across all shards.For each shard ID group, a replica is chosen and the search is run againstit.This means that replicas increase the scalability of the count.
Index¶
- Variables
- type Count
- func (r *Count) AllowNoIndices(allownoindices bool) *Count
- func (r *Count) AnalyzeWildcard(analyzewildcard bool) *Count
- func (r *Count) Analyzer(analyzer string) *Count
- func (r *Count) DefaultOperator(defaultoperator operator.Operator) *Count
- func (r *Count) Df(df string) *Count
- func (r Count) Do(providedCtx context.Context) (*Response, error)
- func (r *Count) ErrorTrace(errortrace bool) *Count
- func (r *Count) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *Count
- func (r *Count) FilterPath(filterpaths ...string) *Count
- func (r *Count) Header(key, value string) *Count
- func (r *Count) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Count) Human(human bool) *Count
- func (r *Count) IgnoreThrottled(ignorethrottled bool) *Count
- func (r *Count) IgnoreUnavailable(ignoreunavailable bool) *Count
- func (r *Count) Index(index string) *Count
- func (r *Count) Lenient(lenient bool) *Count
- func (r *Count) MinScore(minscore string) *Count
- func (r Count) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Count) Preference(preference string) *Count
- func (r *Count) Pretty(pretty bool) *Count
- func (r *Count) Q(q string) *Count
- func (r *Count) Query(query *types.Query) *Count
- func (r *Count) Raw(raw io.Reader) *Count
- func (r *Count) Request(req *Request) *Count
- func (r *Count) Routing(routing string) *Count
- func (r *Count) TerminateAfter(terminateafter string) *Count
- type NewCount
- type Request
- type Response
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¶
typeCount¶
type Count struct {// contains filtered or unexported fields}funcNew¶
func New(tpelastictransport.Interface) *Count
Count search results.Get the number of documents matching a query.
The query can be provided either by using a simple query string as aparameter, or by defining Query DSL within the request body.The query is optional. When no query is provided, the API uses `match_all` tocount all the documents.
The count API supports multi-target syntax. You can run a single count APIsearch across multiple data streams and indices.
The operation is broadcast across all shards.For each shard ID group, a replica is chosen and the search is run againstit.This means that replicas increase the scalability of the count.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html
func (*Count)AllowNoIndices¶
AllowNoIndices If `false`, the request returns an error if any wildcard expression, indexalias, or `_all` value targets only missing or closed indices.This behavior applies even if the request targets other open indices.For example, a request targeting `foo*,bar*` returns an error if an indexstarts with `foo` but no index starts with `bar`.API name: allow_no_indices
func (*Count)AnalyzeWildcard¶
AnalyzeWildcard If `true`, wildcard and prefix queries are analyzed.This parameter can be used only when the `q` query string parameter isspecified.API name: analyze_wildcard
func (*Count)Analyzer¶
Analyzer The analyzer to use for the query string.This parameter can be used only when the `q` query string parameter isspecified.API name: analyzer
func (*Count)DefaultOperator¶
DefaultOperator The default operator for query string query: `AND` or `OR`.This parameter can be used only when the `q` query string parameter isspecified.API name: default_operator
func (*Count)Df¶
Df The field to use as a default when no field prefix is given in the querystring.This parameter can be used only when the `q` query string parameter isspecified.API name: df
func (Count)Do¶
Do runs the request through the transport, handle the response and returns a count.Response
func (*Count)ErrorTrace¶added inv8.14.0
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errorswhen they occur.API name: error_trace
func (*Count)ExpandWildcards¶
func (r *Count) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *Count
ExpandWildcards The type of index that wildcard patterns can match.If the request can target data streams, this argument determines whetherwildcard expressions match hidden data streams.It supports comma-separated values, such as `open,hidden`.API name: expand_wildcards
func (*Count)FilterPath¶added inv8.14.0
FilterPath Comma-separated list of filters in dot notation which reduce the responsereturned by Elasticsearch.API name: filter_path
func (*Count)HttpRequest¶
HttpRequest returns the http.Request object built from thegiven parameters.
func (*Count)Human¶added inv8.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 humanreadable values will be omitted. This makes sense for responses beingconsumedonly by machines.API name: human
func (*Count)IgnoreThrottled¶
IgnoreThrottled If `true`, concrete, expanded, or aliased indices are ignored when frozen.API name: ignore_throttled
func (*Count)IgnoreUnavailable¶
IgnoreUnavailable If `false`, the request returns an error if it targets a missing or closedindex.API name: ignore_unavailable
func (*Count)Index¶
Index A comma-separated list of data streams, indices, and aliases to search.It supports wildcards (`*`).To search all data streams and indices, omit this parameter or use `*` or`_all`.API Name: index
func (*Count)Lenient¶
Lenient If `true`, format-based query failures (such as providing text to a numericfield) in the query string will be ignored.This parameter can be used only when the `q` query string parameter isspecified.API name: lenient
func (*Count)MinScore¶
MinScore The minimum `_score` value that documents must have to be included in theresult.API name: min_score
func (Count)Perform¶added inv8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Count)Preference¶
Preference The node or shard the operation should be performed on.By default, it is random.API name: preference
func (*Count)Pretty¶added inv8.14.0
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only usethis option for debugging only.API name: pretty
func (*Count)Q¶
Q The query in Lucene query string syntax. This parameter cannot be used with arequest body.API name: q
func (*Count)Query¶added inv8.9.0
Query Defines the search query using Query DSL. A request body query cannot be usedwith the `q` query string parameter.API name: query
func (*Count)Raw¶
Raw takes a json payload as input which is then passed to the http.RequestIf specified Raw takes precedence on Request method.
func (*Count)Routing¶
Routing A custom value used to route operations to a specific shard.API name: routing
func (*Count)TerminateAfter¶
TerminateAfter The 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.
IMPORTANT: Use with caution.Elasticsearch applies this parameter to each shard handling the request.When possible, let Elasticsearch perform early termination automatically.Avoid specifying this parameter for requests that target data streams withbacking indices across multiple data tiers.API name: terminate_after
typeNewCount¶
type NewCount func() *Count
NewCount type alias for index.
funcNewCountFunc¶
func NewCountFunc(tpelastictransport.Interface)NewCount
NewCountFunc returns a new instance of Count with the provided transport.Used in the index of the library this allows to retrieve every apis in once place.
typeRequest¶
type Request struct {// Query Defines the search query using Query DSL. A request body query cannot be used// with the `q` query string parameter.Query *types.Query `json:"query,omitempty"`}Request holds the request body struct for the package count
typeResponse¶added inv8.7.0
type Response struct {Countint64 `json:"count"`Shards_types.ShardStatistics `json:"_shards"`}Response holds the response body struct for the package count