query

package
v1.2.12-prerelease2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolQuery

type BoolQuery struct {
	// contains filtered or unexported fields
}

func NewBoolQuery

func NewBoolQuery() *BoolQuery

Creates a new bool query.

func (*BoolQuery) Filter

func (q *BoolQuery) Filter(filters ...Query) *BoolQuery

func (*BoolQuery) Must

func (q *BoolQuery) Must(queries ...Query) *BoolQuery

func (*BoolQuery) MustNot

func (q *BoolQuery) MustNot(queries ...Query) *BoolQuery

func (*BoolQuery) Source

func (q *BoolQuery) Source() (interface{}, error)

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) From

func (b *Builder) From(from int) *Builder

func (*Builder) Query

func (b *Builder) Query(query Query) *Builder

func (*Builder) SearchAfter

func (b *Builder) SearchAfter(v ...interface{}) *Builder

func (*Builder) Size

func (b *Builder) Size(size int) *Builder

func (*Builder) Sortby

func (b *Builder) Sortby(sorters ...Sorter) *Builder

func (*Builder) Source

func (b *Builder) Source() (interface{}, error)

Source returns the serializable JSON for the source builder.

func (*Builder) String

func (b *Builder) String() (string, error)

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

func NewFieldSort(fieldName string) *FieldSort

NewFieldSort creates a new FieldSort.

func (*FieldSort) Asc

func (s *FieldSort) Asc() *FieldSort

Asc sets ascending sort order.

func (*FieldSort) Desc

func (s *FieldSort) Desc() *FieldSort

Desc sets descending sort order.

func (*FieldSort) FieldName

func (s *FieldSort) FieldName(fieldName string) *FieldSort

FieldName specifies the name of the field to be used for sorting.

func (*FieldSort) Order

func (s *FieldSort) Order(ascending bool) *FieldSort

Order defines whether sorting ascending (default) or descending.

func (*FieldSort) Source

func (s *FieldSort) Source() (interface{}, error)

Source returns the JSON-serializable data.

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.

type Sorter

type Sorter interface {
	Source() (interface{}, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL