Documentation ¶
Index ¶
- type BoolQuery
- type Builder
- func (b *Builder) From(from int) *Builder
- func (b *Builder) Query(query Query) *Builder
- func (b *Builder) SearchAfter(v ...interface{}) *Builder
- func (b *Builder) Size(size int) *Builder
- func (b *Builder) Sortby(sorters ...Sorter) *Builder
- func (b *Builder) Source() (interface{}, error)
- func (b *Builder) String() (string, error)
- type ExistsQuery
- type FieldSort
- type MatchQuery
- func (q *MatchQuery) Analyzer(analyzer string) *MatchQuery
- func (q *MatchQuery) Boost(boost float64) *MatchQuery
- func (q *MatchQuery) CutoffFrequency(cutoff float64) *MatchQuery
- func (q *MatchQuery) Fuzziness(fuzziness string) *MatchQuery
- func (q *MatchQuery) FuzzyRewrite(fuzzyRewrite string) *MatchQuery
- func (q *MatchQuery) FuzzyTranspositions(fuzzyTranspositions bool) *MatchQuery
- func (q *MatchQuery) Lenient(lenient bool) *MatchQuery
- func (q *MatchQuery) MaxExpansions(maxExpansions int) *MatchQuery
- func (q *MatchQuery) MinimumShouldMatch(minimumShouldMatch string) *MatchQuery
- func (q *MatchQuery) Operator(operator string) *MatchQuery
- func (q *MatchQuery) PrefixLength(prefixLength int) *MatchQuery
- func (q *MatchQuery) QueryName(queryName string) *MatchQuery
- func (q *MatchQuery) Source() (interface{}, error)
- func (q *MatchQuery) ZeroTermsQuery(zeroTermsQuery string) *MatchQuery
- type Query
- type RangeQuery
- func (q *RangeQuery) From(from interface{}) *RangeQuery
- func (q *RangeQuery) Gt(from interface{}) *RangeQuery
- func (q *RangeQuery) Gte(from interface{}) *RangeQuery
- func (q *RangeQuery) IncludeLower(includeLower bool) *RangeQuery
- func (q *RangeQuery) IncludeUpper(includeUpper bool) *RangeQuery
- func (q *RangeQuery) Lt(to interface{}) *RangeQuery
- func (q *RangeQuery) Lte(to interface{}) *RangeQuery
- func (q *RangeQuery) Source() (interface{}, error)
- func (q *RangeQuery) To(to interface{}) *RangeQuery
- type Sorter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder() *Builder
func (*Builder) SearchAfter ¶
type ExistsQuery ¶
type ExistsQuery struct {
// contains filtered or unexported fields
}
ExistsQuery is a query that only matches on documents that the field has a value in them.
For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-exists-query.html
func NewExistsQuery ¶
func NewExistsQuery(name string) *ExistsQuery
NewExistsQuery creates and initializes a new exists query.
func (*ExistsQuery) QueryName ¶
func (q *ExistsQuery) QueryName(queryName string) *ExistsQuery
QueryName sets the query name for the filter that can be used when searching for matched queries per hit.
func (*ExistsQuery) Source ¶
func (q *ExistsQuery) Source() (interface{}, error)
Source returns the JSON serializable content for this query.
type FieldSort ¶
type FieldSort struct { Sorter // contains filtered or unexported fields }
FieldSort sorts by a given field.
func NewFieldSort ¶
NewFieldSort creates a new FieldSort.
type MatchQuery ¶
type MatchQuery struct {
// contains filtered or unexported fields
}
MatchQuery is a family of queries that accepts text/numerics/dates, analyzes them, and constructs a query.
To create a new MatchQuery, use NewMatchQuery. To create specific types of queries, e.g. a match_phrase query, use NewMatchPhrQuery(...).Type("phrase"), or use one of the shortcuts e.g. NewMatchPhraseQuery(...).
For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-match-query.html
func NewMatchQuery ¶
func NewMatchQuery(name string, text interface{}) *MatchQuery
NewMatchQuery creates and initializes a new MatchQuery.
func (*MatchQuery) Analyzer ¶
func (q *MatchQuery) Analyzer(analyzer string) *MatchQuery
Analyzer explicitly sets the analyzer to use. It defaults to use explicit mapping config for the field, or, if not set, the default search analyzer.
func (*MatchQuery) Boost ¶
func (q *MatchQuery) Boost(boost float64) *MatchQuery
Boost sets the boost to apply to this query.
func (*MatchQuery) CutoffFrequency ¶
func (q *MatchQuery) CutoffFrequency(cutoff float64) *MatchQuery
CutoffFrequency can be a value in [0..1] (or an absolute number >=1). It represents the maximum treshold of a terms document frequency to be considered a low frequency term.
func (*MatchQuery) Fuzziness ¶
func (q *MatchQuery) Fuzziness(fuzziness string) *MatchQuery
Fuzziness sets the fuzziness when evaluated to a fuzzy query type. Defaults to "AUTO".
func (*MatchQuery) FuzzyRewrite ¶
func (q *MatchQuery) FuzzyRewrite(fuzzyRewrite string) *MatchQuery
FuzzyRewrite sets the fuzzy_rewrite parameter controlling how the fuzzy query will get rewritten.
func (*MatchQuery) FuzzyTranspositions ¶
func (q *MatchQuery) FuzzyTranspositions(fuzzyTranspositions bool) *MatchQuery
FuzzyTranspositions sets whether transpositions are supported in fuzzy queries.
The default metric used by fuzzy queries to determine a match is the Damerau-Levenshtein distance formula which supports transpositions. Setting transposition to false will * switch to classic Levenshtein distance. * If not set, Damerau-Levenshtein distance metric will be used.
func (*MatchQuery) Lenient ¶
func (q *MatchQuery) Lenient(lenient bool) *MatchQuery
Lenient specifies whether format based failures will be ignored.
func (*MatchQuery) MaxExpansions ¶
func (q *MatchQuery) MaxExpansions(maxExpansions int) *MatchQuery
MaxExpansions is used with fuzzy or prefix type queries. It specifies the number of term expansions to use. It defaults to unbounded so that its recommended to set it to a reasonable value for faster execution.
func (*MatchQuery) MinimumShouldMatch ¶
func (q *MatchQuery) MinimumShouldMatch(minimumShouldMatch string) *MatchQuery
MinimumShouldMatch sets the optional minimumShouldMatch value to apply to the query.
func (*MatchQuery) Operator ¶
func (q *MatchQuery) Operator(operator string) *MatchQuery
Operator sets the operator to use when using a boolean query. Can be "AND" or "OR" (default).
func (*MatchQuery) PrefixLength ¶
func (q *MatchQuery) PrefixLength(prefixLength int) *MatchQuery
PrefixLength sets the length of a length of common (non-fuzzy) prefix for fuzzy match queries. It must be non-negative.
func (*MatchQuery) QueryName ¶
func (q *MatchQuery) QueryName(queryName string) *MatchQuery
QueryName sets the query name for the filter that can be used when searching for matched filters per hit.
func (*MatchQuery) Source ¶
func (q *MatchQuery) Source() (interface{}, error)
Source returns JSON for the function score query.
func (*MatchQuery) ZeroTermsQuery ¶
func (q *MatchQuery) ZeroTermsQuery(zeroTermsQuery string) *MatchQuery
ZeroTermsQuery can be "all" or "none".
type Query ¶
type Query interface { // Source returns the JSON-serializable query request. Source() (interface{}, error) }
type RangeQuery ¶
type RangeQuery struct {
// contains filtered or unexported fields
}
RangeQuery matches documents with fields that have terms within a certain range.
For details, see https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-range-query.html
func NewRangeQuery ¶
func NewRangeQuery(name string) *RangeQuery
NewRangeQuery creates and initializes a new RangeQuery.
func (*RangeQuery) From ¶
func (q *RangeQuery) From(from interface{}) *RangeQuery
From indicates the from part of the RangeQuery. Use nil to indicate an unbounded from part.
func (*RangeQuery) Gt ¶
func (q *RangeQuery) Gt(from interface{}) *RangeQuery
Gt indicates a greater-than value for the from part. Use nil to indicate an unbounded from part.
func (*RangeQuery) Gte ¶
func (q *RangeQuery) Gte(from interface{}) *RangeQuery
Gte indicates a greater-than-or-equal value for the from part. Use nil to indicate an unbounded from part.
func (*RangeQuery) IncludeLower ¶
func (q *RangeQuery) IncludeLower(includeLower bool) *RangeQuery
IncludeLower indicates whether the lower bound should be included or not. Defaults to true.
func (*RangeQuery) IncludeUpper ¶
func (q *RangeQuery) IncludeUpper(includeUpper bool) *RangeQuery
IncludeUpper indicates whether the upper bound should be included or not. Defaults to true.
func (*RangeQuery) Lt ¶
func (q *RangeQuery) Lt(to interface{}) *RangeQuery
Lt indicates a less-than value for the to part. Use nil to indicate an unbounded to part.
func (*RangeQuery) Lte ¶
func (q *RangeQuery) Lte(to interface{}) *RangeQuery
Lte indicates a less-than-or-equal value for the to part. Use nil to indicate an unbounded to part.
func (*RangeQuery) Source ¶
func (q *RangeQuery) Source() (interface{}, error)
Source returns JSON for the query.
func (*RangeQuery) To ¶
func (q *RangeQuery) To(to interface{}) *RangeQuery
To indicates the to part of the RangeQuery. Use nil to indicate an unbounded to part.