dsl

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Query                  Query
	MatchAllQuery          MatchAllQuery
	CombinedFieldQuery     CombinedFieldQuery
	ExistsQuery            ExistsQuery
	BoolQuery              BoolQuery
	MatchQuery             MatchQuery
	MatchNoneQuery         MatchNoneQuery
	Fuzzyquery             Fuzzyquery
	SimpleQueryStringQuery SimpleQueryStringQuery
	NestedQuery            NestedQuery
	TermQuery              TermQuery
	TermsQuery             TermsQuery
	Search                 Search
	Aggs                   Aggs
	AggNested              AggNested
	AggTerms               AggTerms
	AggFilter              AggFilter
	AggScript              AggScript
	IndicesBoost           IndicesBoost
	Fields                 Fields
	FieldsField            FieldsField
}

func NewApi

func NewApi() *API

type AggFilter

type AggFilter func(name string, field string, value string, o ...func(AggFilter *tAggFilter)) *tAggFilter

AggFilter returns an AggFilter body.

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/8.6/search-AggFilterregations.html

func NewAggFilter

func NewAggFilter() AggFilter

func (*AggFilter) WithAggs

func (*AggFilter) WithAggs(aggs ...BaseAgg) func(all *tAggFilter)

type AggNested

type AggNested func(name string, path string, aggs *tAggs, o ...func(aggNestes *tAggNested)) *tAggNested

AggNested returns a nested body

See full documentations at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-nested-aggregation.html

func NewAggNested

func NewAggNested() AggNested

type AggScript

type AggScript func(name string, bucketsPath map[string]string, o ...func(AggScript *tAggScript)) *tAggScript

AggScript returns an AggScript body.

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/8.6/search-AggScriptregations.html

func NewAggScript

func NewAggScript() AggScript

func (*AggScript) WithFormat

func (*AggScript) WithFormat(format string) func(all *tAggScript)

func (*AggScript) WithGapPolicy

func (*AggScript) WithGapPolicy(gapPolicy GapPolicy) func(all *tAggScript)

type AggTerms

type AggTerms func(name string, field string, o ...func(AggTerms *tAggTerms)) *tAggTerms

AggTerms returns an AggTerms body.

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/8.6/search-AggTermsregations.html

func NewAggTerms

func NewAggTerms() AggTerms

func (*AggTerms) WithDocCountErrorUpperBound

func (*AggTerms) WithDocCountErrorUpperBound(DocCountErrorUpperBound int) func(all *tAggTerms)

func (*AggTerms) WithExclude

func (*AggTerms) WithExclude(Exclude []string) func(all *tAggTerms)

func (*AggTerms) WithExecutionHint

func (*AggTerms) WithExecutionHint(executionHint ExecutionHint) func(all *tAggTerms)

func (*AggTerms) WithInclude

func (*AggTerms) WithInclude(Include []string) func(all *tAggTerms)

func (*AggTerms) WithMissing

func (*AggTerms) WithMissing(missing string) func(all *tAggTerms)

func (*AggTerms) WithOrder

func (*AggTerms) WithOrder(Order *AggTermsOrder) func(all *tAggTerms)

func (*AggTerms) WithShardMinDocCount

func (*AggTerms) WithShardMinDocCount(ShardMinDocCount int) func(all *tAggTerms)

func (*AggTerms) WithShardSize

func (*AggTerms) WithShardSize(shardSize int) func(all *tAggTerms)

func (*AggTerms) WithShowTermDocCountError

func (*AggTerms) WithShowTermDocCountError(ShowTermDocCountError bool) func(all *tAggTerms)

func (*AggTerms) WithSize

func (*AggTerms) WithSize(size int) func(all *tAggTerms)

func (*AggTerms) WithSumOtherDocCount

func (*AggTerms) WithSumOtherDocCount(SumOtherDocCount int) func(all *tAggTerms)

func (*AggTerms) WithValueType

func (*AggTerms) WithValueType(valueType string) func(all *tAggTerms)

type AggTermsOrder

type AggTermsOrder struct {
	Field string `json:"-"`
	Order Order  `json:"-"`
}

func (*AggTermsOrder) MarshalJSON

func (ato *AggTermsOrder) MarshalJSON() ([]byte, error)

type Aggs

type Aggs func(o ...func(aggs *tAggs)) *tAggs

Aggs returns an aggs body.

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/8.6/search-aggregations.html

func NewAggs

func NewAggs() Aggs

func (*Aggs) WithAggregations

func (a *Aggs) WithAggregations(aggs ...BaseAgg) func(all *tAggs)

type BaseAgg

type BaseAgg interface {
	GetAggName() string
}

type BaseQuery

type BaseQuery interface {
	GetQueryName() string
}

BaseQuery https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html

type BoolQuery

type BoolQuery func(o ...func(all *tBoolQuery)) BaseQuery

BoolQuery results a bool query struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

func NewBoolQuery

func NewBoolQuery() BoolQuery

func (*BoolQuery) WithFilter

func (q *BoolQuery) WithFilter(bq ...BaseQuery) func(all *tBoolQuery)

func (*BoolQuery) WithMinimumShouldMatch

func (q *BoolQuery) WithMinimumShouldMatch(msm *MinimumShouldMatch) func(all *tBoolQuery)

func (*BoolQuery) WithMust

func (q *BoolQuery) WithMust(bq ...BaseQuery) func(all *tBoolQuery)

func (*BoolQuery) WithMustNot

func (q *BoolQuery) WithMustNot(bq ...BaseQuery) func(all *tBoolQuery)

func (*BoolQuery) WithShould

func (q *BoolQuery) WithShould(bq ...BaseQuery) func(all *tBoolQuery)

type CollectMode

type CollectMode string
const (
	CollectModeBreadthFirst CollectMode = "breadth_first"
	CollectModeDepthFirst   CollectMode = "depth_first"
)

type CombinedFieldQuery

type CombinedFieldQuery func(fields []string, query string, o ...func(all *tCombinedFieldsQuery)) BaseQuery

CombindedFieldQuery results a combined_field query struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-combined-fields-query.html

func NewCombinedFieldQuery

func NewCombinedFieldQuery() CombinedFieldQuery

func (*CombinedFieldQuery) WithAutoGenerateSynonymsPhraseQuery

func (q *CombinedFieldQuery) WithAutoGenerateSynonymsPhraseQuery(b bool) func(all *tCombinedFieldsQuery)

func (*CombinedFieldQuery) WithMinimumShouldMatch

func (q *CombinedFieldQuery) WithMinimumShouldMatch(v string) func(all *tCombinedFieldsQuery)

func (*CombinedFieldQuery) WithOperator

func (q *CombinedFieldQuery) WithOperator(o QueryOperator) func(all *tCombinedFieldsQuery)

func (*CombinedFieldQuery) WithZeroTermsQuery

func (q *CombinedFieldQuery) WithZeroTermsQuery(v QueryZeroTermsQuery) func(all *tCombinedFieldsQuery)

type ExecutionHint

type ExecutionHint string
const (
	ExecutionHintMap            ExecutionHint = "map"
	ExecutionHintGlobalOrdinals ExecutionHint = "global_ordinals"
)

type ExistsQuery

type ExistsQuery func(field string, o ...func(all *tExistsQuery)) BaseQuery

ExistsQuery results a combined_field query struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html

func NewExistsQuery

func NewExistsQuery() ExistsQuery

type Fields

type Fields func(o ...func(fields *tFields)) *tFields

Fields returns an fields body.

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/8.6/search-fieldregations.html

func NewFields

func NewFields() Fields

func (*Fields) WithFields

func (a *Fields) WithFields(fields ...*tFieldsField) func(all *tFields)

type FieldsField

type FieldsField func(name string, o ...func(FieldsField *tFieldsField)) *tFieldsField

FieldsField returns an FieldsField body.

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/8.6/search-FieldsFieldregations.html

func NewFieldsField

func NewFieldsField() FieldsField

func (*FieldsField) WithFormat

func (*FieldsField) WithFormat(format string) func(all *tFieldsField)

type Fuzzyquery

type Fuzzyquery func(field string, value string, o ...func(all *tFuzzyQuery)) BaseQuery

FuzzyQuery results a fuzzy query struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html

func NewFuzzyQuery

func NewFuzzyQuery() Fuzzyquery

func (*Fuzzyquery) WithFuzziness

func (fq *Fuzzyquery) WithFuzziness(fuzziness string) func(all *tFuzzyQuery)

func (*Fuzzyquery) WithMaxExpansion

func (fq *Fuzzyquery) WithMaxExpansion(maxExpansion int) func(all *tFuzzyQuery)

func (*Fuzzyquery) WithPrefixLength

func (fq *Fuzzyquery) WithPrefixLength(prefixLength int) func(all *tFuzzyQuery)

func (*Fuzzyquery) WithRewrite

func (fq *Fuzzyquery) WithRewrite(rewrite QueryRewrite) func(all *tFuzzyQuery)

func (*Fuzzyquery) WithTranspositions

func (fq *Fuzzyquery) WithTranspositions(transpositions bool) func(all *tFuzzyQuery)

type GapPolicy

type GapPolicy string
const (
	GapPolicySkip        GapPolicy = "skip"
	GapPolicyInsertZeros GapPolicy = "insert_zeros"
	GapPolicyKeepValues  GapPolicy = "keep_values"
)

type IDsQuery

type IDsQuery struct {
	IDs []string `json:"ids,omitempty"`
}

func (*IDsQuery) GetQueryName

func (*IDsQuery) GetQueryName() string

type IndicesBoost

type IndicesBoost func(o ...func(all tIndicesBoost)) tIndicesBoost

IndicesBoost results a indices_boost struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multiple-indices.html

func NewIndicesBoost

func NewIndicesBoost() IndicesBoost

func (*IndicesBoost) AppendIndex

func (ib *IndicesBoost) AppendIndex(index string, boost float64) func(all tIndicesBoost)

type IntervalsQuery

type IntervalsQuery struct {
	Field    string                  `json:"-"`
	Match    *InvervalsQueryMatch    `json:"match,omitempty"`
	Prefix   *InvervalsQueryPrefix   `json:"prefix,omitempty"`
	Wildcard *InvervalsQueryWildcard `json:"wildcard,omitempty"`
	Fuzzy    *InvervalsQueryFuzzy    `json:"fuzzy,omitempty"`
	AllOf    *InvervalsQueryAllOf    `json:"all_of,omitempty"`
	AnyOf    *InvervalsQueryAnyOf    `json:"any_of,omitempty"`
}

func (*IntervalsQuery) GetQueryName

func (i *IntervalsQuery) GetQueryName() string

func (*IntervalsQuery) MarshalJSON

func (i *IntervalsQuery) MarshalJSON() ([]byte, error)

type InvervalsQueryAllOf

type InvervalsQueryAllOf struct {
	Intervals []any                 `json:"intervals"`
	MaxGaps   int                   `json:"max_gaps,omitempty"` // default: -1
	Ordered   bool                  `json:"ordered,omitempty"`  // default: false
	Filter    *InvervalsQueryFilter `json:"filter,omitempty"`
}

type InvervalsQueryAnyOf

type InvervalsQueryAnyOf struct {
	Intervals []any                 `json:"intervals"`
	Filter    *InvervalsQueryFilter `json:"filter,omitempty"`
}

type InvervalsQueryFilter

type InvervalsQueryFilter struct {
	After          *BaseQuery `json:"after,omitempty"`
	Before         *BaseQuery `json:"before,omitempty"`
	ContainedBy    *BaseQuery `json:"contained_by,omitempty"`
	Containing     *BaseQuery `json:"containing,omitempty"`
	NotContainedBy *BaseQuery `json:"not_contained_by,omitempty"`
	NotContaining  *BaseQuery `json:"not_containing,omitempty"`
	NotOverlapping *BaseQuery `json:"not_overlapping,omitempty"`
	Overlapping    *BaseQuery `json:"overlapping,omitempty"`
	Script         *Script    `json:"script,omitempty"`
}

type InvervalsQueryFuzzy

type InvervalsQueryFuzzy struct {
	Term           string `json:"term"`
	PrefixLength   int    `json:"prefix_length"`            // default: 0
	Transpositions bool   `json:"transpositions,omitempty"` // default: false
	Fuzziness      string `json:"fuzziness,omitempty"`      // default: "auto"
	Analyzer       string `json:"analyzer,omitempty"`
	UseField       string `json:"use_field,omitempty"`
}

type InvervalsQueryMatch

type InvervalsQueryMatch struct {
	Query    string                `json:"query"`
	MaxGaps  int                   `json:"max_gaps,omitempty"` // default: -1
	Ordered  bool                  `json:"ordered,omitempty"`  // default: false
	Analyzer string                `json:"analyzer,omitempty"`
	Filter   *InvervalsQueryFilter `json:"filter,omitempty"`
	UseField string                `json:"use_field,omitempty"`
}

type InvervalsQueryPrefix

type InvervalsQueryPrefix struct {
	Prefix   string `json:"prefix"`
	Analyzer string `json:"analyzer,omitempty"`
	UseField string `json:"use_field,omitempty"`
}

type InvervalsQueryWildcard

type InvervalsQueryWildcard struct {
	Pattern  string `json:"pattern"`
	Analyzer string `json:"analyzer,omitempty"`
	UseField string `json:"use_field,omitempty"`
}

type MatchAllQuery

type MatchAllQuery func(o ...func(all *tMatchAllQuery)) BaseQuery

MatchAllQuery results a match_all query struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html

func NewMatchAllQuery

func NewMatchAllQuery() MatchAllQuery

func (*MatchAllQuery) WithBoost

func (qma *MatchAllQuery) WithBoost(boost float64) func(all *tMatchAllQuery)

type MatchBoolPrefixQuery

type MatchBoolPrefixQuery struct {
	Field    string `json:"-"`
	Query    string `json:"query"`
	Analyzer string `json:"analyzer,omitempty"`
}

func (*MatchBoolPrefixQuery) GetQueryName

func (mb *MatchBoolPrefixQuery) GetQueryName() string

func (*MatchBoolPrefixQuery) MarshalJSON

func (mb *MatchBoolPrefixQuery) MarshalJSON() ([]byte, error)

type MatchNoneQuery

type MatchNoneQuery func(o ...func(all *tMatchNoneQuery)) BaseQuery

MatchAllQuery results a match_all query struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html

func NewMatchNoneQuery

func NewMatchNoneQuery() MatchNoneQuery

type MatchPhrasePrefixQuery

type MatchPhrasePrefixQuery struct {
	Field          string              `json:"-"`
	Query          string              `json:"query"`
	Analyzer       string              `json:"analyzer,omitempty"`
	MaxExpansions  int                 `json:"max_expansions,omitempty"`   // default: 50
	Slop           int                 `json:"slop,omitempty"`             // default: 0
	ZeroTermsQuery QueryZeroTermsQuery `json:"zero_terms_query,omitempty"` // default: QeruyZeroTermsQueryNONE
}

func (*MatchPhrasePrefixQuery) GetQueryName

func (mpp *MatchPhrasePrefixQuery) GetQueryName() string

func (*MatchPhrasePrefixQuery) MarshalJSON

func (mpp *MatchPhrasePrefixQuery) MarshalJSON() ([]byte, error)

type MatchPhraseQuery

type MatchPhraseQuery struct {
	Field    string `json:"-"`
	Query    string `json:"query"`
	Analyzer string `json:"analyzer,omitempty"`
}

func (*MatchPhraseQuery) GetQueryName

func (mp *MatchPhraseQuery) GetQueryName() string

func (*MatchPhraseQuery) MarshalJSON

func (mp *MatchPhraseQuery) MarshalJSON() ([]byte, error)

type MatchQuery

type MatchQuery func(field string, query string, o ...func(all *tMatchQuery)) BaseQuery

MatchQuery results a match query struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/8.6/query-dsl-match-query.html

func NewMatchQuery

func NewMatchQuery() MatchQuery

func (*MatchQuery) WithAnalyzer

func (q *MatchQuery) WithAnalyzer(v string) func(all *tMatchQuery)

func (*MatchQuery) WithAutoGenerateSynonymsPhraseQuery

func (q *MatchQuery) WithAutoGenerateSynonymsPhraseQuery(v bool) func(all *tMatchQuery)

func (*MatchQuery) WithFuzziness

func (q *MatchQuery) WithFuzziness(v string) func(all *tMatchQuery)

func (*MatchQuery) WithFuzzyRewrite

func (q *MatchQuery) WithFuzzyRewrite(v string) func(all *tMatchQuery)

func (*MatchQuery) WithFuzzyTranspositions

func (q *MatchQuery) WithFuzzyTranspositions(v bool) func(all *tMatchQuery)

func (*MatchQuery) WithLenient

func (q *MatchQuery) WithLenient(v bool) func(all *tMatchQuery)

func (*MatchQuery) WithMaxExpansions

func (q *MatchQuery) WithMaxExpansions(v int) func(all *tMatchQuery)

func (*MatchQuery) WithMinimumShouldMatch

func (q *MatchQuery) WithMinimumShouldMatch(v *MinimumShouldMatch) func(all *tMatchQuery)

func (*MatchQuery) WithOperator

func (q *MatchQuery) WithOperator(v QueryOperator) func(all *tMatchQuery)

func (*MatchQuery) WithPrefixLength

func (q *MatchQuery) WithPrefixLength(v int) func(all *tMatchQuery)

func (*MatchQuery) WithZeroTermsQuery

func (q *MatchQuery) WithZeroTermsQuery(v QueryZeroTermsQuery) func(all *tMatchQuery)

type MinimumShouldMatch

type MinimumShouldMatch struct {
	StringValue string
	IntValue    int
}

func (*MinimumShouldMatch) MarshalJSON

func (msm *MinimumShouldMatch) MarshalJSON() ([]byte, error)

type MultiMatchQuery

type MultiMatchQuery struct {
	Fields                          []string            `json:"fields,omitempty"`
	Query                           string              `json:"query"`
	Type                            QueryMultiMatchType `json:"type,omitempty"` // default: QueryMultiMatchTypeBestFields
	Analyzer                        string              `json:"analyzer,omitempty"`
	AutoGenerateSynonymsPhraseQuery bool                `json:"auto_generate_synonyms_phrase_query,omitempty"`
	Fuzziness                       string              `json:"fuzziness,omitempty"`
	MaxExpansions                   int                 `json:"max_expansions,omitempty"`       // default: 50
	PrefixLength                    int                 `json:"prefix_length,omitempty"`        // default: 0
	FuzzyTranspositions             bool                `json:"fuzzy_transpositions,omitempty"` // default: true
	FuzzyRewrite                    string              `json:"fuzzy_rewrite,omitempty"`
	Lenient                         bool                `json:"lenient,omitempty"`  // default: false
	Operator                        QueryOperator       `json:"operator,omitempty"` // default: QueryOperatorOR
	MinimumShouldMatch              string              `json:"minimum_should_match,omitempty"`
	ZeroTermsQuery                  QueryZeroTermsQuery `json:"zero_terms_query,omitempty"` // default: QeruyZeroTermsQueryNONE
	TieBreaker                      float64             `json:"tie_breaker,omitempty"`      // default: 0.0
}

func (*MultiMatchQuery) GetQueryName

func (*MultiMatchQuery) GetQueryName() string

type MultiType

type MultiType struct {
	FloatVal  float64
	StringVal string
	DateVal   time.Time
}

func (*MultiType) IsDate

func (mt *MultiType) IsDate() bool

func (*MultiType) MarshalJSON

func (mt *MultiType) MarshalJSON() ([]byte, error)

func (*MultiType) TimeFormat

func (mt *MultiType) TimeFormat() string

type NestedQuery

type NestedQuery func(path string, query *tQuery, o ...func(all *tNestedQuery)) BaseQuery

NestedQuery return a nested body

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html

func NewNestedQuery

func NewNestedQuery() NestedQuery

func (*NestedQuery) WithIgnoreUnmapped

func (nq *NestedQuery) WithIgnoreUnmapped(ignoreUnmapped bool) func(all *tNestedQuery)

func (*NestedQuery) WithScoreMode

func (nq *NestedQuery) WithScoreMode(mode ScoreMode) func(all *tNestedQuery)

type Order

type Order string
const (
	OrderASC  Order = "asc"
	OrderDESC Order = "desc"
)

type PrefixQuery

type PrefixQuery struct {
	Field           string       `json:"-"`
	Value           string       `json:"value"`
	Rewrite         QueryRewrite `json:"rewrite,omitempty"`
	CaseInsensitive bool         `json:"case_insensitive,omitempty"` // default: false
}

func (*PrefixQuery) GetQueryName

func (f *PrefixQuery) GetQueryName() string

func (*PrefixQuery) MarshalJSON

func (f *PrefixQuery) MarshalJSON() ([]byte, error)

type Query

type Query func(query BaseQuery, o ...func(*tQuery)) *tQuery

Query returns results a query body.

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html

func NewQuery

func NewQuery() Query

type QueryExpandWildcards

type QueryExpandWildcards string
const (
	QueryExpandWildcardsAll    QueryExpandWildcards = "all"
	QueryExpandWildcardsOpen   QueryExpandWildcards = "open"
	QueryExpandWildcardsClosed QueryExpandWildcards = "closed"
	QueryExpandWildcardsHidden QueryExpandWildcards = "hidden"
	QueryExpandWildcardsNone   QueryExpandWildcards = "none"
)

type QueryMultiMatchType

type QueryMultiMatchType string
const (
	QueryMultiMatchTypeBestFields   QueryMultiMatchType = "best_fields"
	QueryMultiMatchTypeMostFields   QueryMultiMatchType = "most_fields"
	QueryMultiMatchTypeCrossFields  QueryMultiMatchType = "cross_fields"
	QueryMultiMatchTypePhrase       QueryMultiMatchType = "phrase"
	QueryMultiMatchTypePhrasePrefix QueryMultiMatchType = "phrase_prefix"
	QueryMultiMatchTypeBoolPrefix   QueryMultiMatchType = "bool_prefix"
)

type QueryOperator

type QueryOperator string
const (
	QueryOperatorOR  QueryOperator = "OR"
	QueryOperatorAND QueryOperator = "AND"
)

type QueryRelation

type QueryRelation string
const (
	QueryRelationINTERSECTS QueryRelation = "INTERSECTS"
	QueryRelationCONTAINS   QueryRelation = "CONTAINS"
	QueryRelationWITHIN     QueryRelation = "WITHIN"
)

type QueryRewrite

type QueryRewrite string
const (
	QueryRewriteConstantScore         QueryRewrite = "constant_score"
	QueryRewriteScoringboolean        QueryRewrite = "scoring_boolean"
	QueryRewriteTopTermsBlendedFreqsN QueryRewrite = "top_terms_blended_freqs_N"
	QueryRewriteTopTermsBoostN        QueryRewrite = "top_terms_boost_N"
	QueryRewriteTopTermsN             QueryRewrite = "top_terms_N"
)

type QuerySearchType

type QuerySearchType string
const (
	QuerySearchTypeQueryThenFetch    QuerySearchType = "query_then_fetch"
	QuerySearchDFSTypeQueryThenFetch QuerySearchType = "dfs_query_then_fetch"
)

type QuerySimpleQueryStringFlag

type QuerySimpleQueryStringFlag string
const (
	QuerySimpleQueryStringFlagALL        QuerySimpleQueryStringFlag = "ALL"
	QuerySimpleQueryStringFlagAND        QuerySimpleQueryStringFlag = "AND"
	QuerySimpleQueryStringFlagESCAPE     QuerySimpleQueryStringFlag = "ESCAPE"
	QuerySimpleQueryStringFlagFUZZY      QuerySimpleQueryStringFlag = "FUZZY"
	QuerySimpleQueryStringFlagNEAR       QuerySimpleQueryStringFlag = "NEAR"
	QuerySimpleQueryStringFlagNONE       QuerySimpleQueryStringFlag = "NONE"
	QuerySimpleQueryStringFlagNOT        QuerySimpleQueryStringFlag = "NOT"
	QuerySimpleQueryStringFlagOR         QuerySimpleQueryStringFlag = "OR"
	QuerySimpleQueryStringFlagPHRASE     QuerySimpleQueryStringFlag = "PHRASE"
	QuerySimpleQueryStringFlagPRECEDENCE QuerySimpleQueryStringFlag = "PRECEDENCE"
	QuerySimpleQueryStringFlagPREFIX     QuerySimpleQueryStringFlag = "PREFIX"
	QuerySimpleQueryStringFlagSLOP       QuerySimpleQueryStringFlag = "SLOP"
	QuerySimpleQueryStringFlagWHITESPACE QuerySimpleQueryStringFlag = "WHITESPACE"
)

type QueryZeroTermsQuery

type QueryZeroTermsQuery string
const (
	QeruyZeroTermsQueryNONE QueryZeroTermsQuery = "none"
	QueryZeroTermsQueryALL  QueryZeroTermsQuery = "all"
)

type RangeQuery

type RangeQuery struct {
	Field    string        `json:"-"`
	GT       *MultiType    `json:"gt,omitempty"`
	GTE      *MultiType    `json:"gte,omitempty"`
	LT       *MultiType    `json:"lt,omitempty"`
	LTE      *MultiType    `json:"lte,omitempty"`
	Format   string        `json:"format,omitempty"`
	Relation QueryRelation `json:"relation,omitempty"`
	TimeZone string        `json:"time_zone,omitempty"`
	Boost    float64       `json:"boost,omitempty"` // default: 1.0
}

func (*RangeQuery) GetQueryName

func (*RangeQuery) GetQueryName() string

func (*RangeQuery) MarshalJSON

func (r *RangeQuery) MarshalJSON() ([]byte, error)

type ScoreMode

type ScoreMode string
const (
	ScoreModeAVG  ScoreMode = "avg"
	ScoreModeMAX  ScoreMode = "max"
	ScoreModeMIN  ScoreMode = "min"
	ScoreModeNONE ScoreMode = "none"
	ScoreModeSUM  ScoreMode = "sum"
)

type Script

type Script struct {
	Lang   string         `json:"lang,omitempty"` // default: "painless"
	Source string         `json:"source,omitempty"`
	Id     string         `json:"id,omitempty"`
	Params map[string]any `json:"params,omitempty"`
}
type Search func(o ...func(all *tSearch)) *tSearch

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html

func NewSearch

func NewSearch() Search

func (*Search) WithAggs

func (*Search) WithAggs(aggs ...BaseAgg) func(all *tSearch)

func (*Search) WithFields

func (*Search) WithFields(fields *tFields) func(all *tSearch)

func (*Search) WithIndicesBoost

func (*Search) WithIndicesBoost(ib tIndicesBoost) func(all *tSearch)

func (*Search) WithQuery

func (*Search) WithQuery(query *tQuery) func(all *tSearch)

type SearchQueryParams

type SearchQueryParams struct {
	AllowNoIndices             bool                 `json:"allow_no_indices,omitempty"`             // default: true
	AllowPartialSearchResults  bool                 `json:"allow_partial_search_results,omitempty"` // default: true
	Analyzer                   string               `json:"analyzer,omitempty"`
	AnalyzeWildcard            bool                 `json:"analyze_wildcard,omitempty"`        // default: false
	BatchedReduceSize          int                  `json:"batched_reduce_size,omitempty"`     // default: 512
	CSSMinimizeRoundtrips      bool                 `json:"css_minimize_roundtrips,omitempty"` // default: true
	DefaultOperator            QueryOperator        `json:"default_operator,omitempty"`        // default: QueryOperatorOR
	DF                         string               `json:"df,omitempty"`
	DocvalueFields             []string             `json:"docvalue_fields,omitempty"`
	ExpandWildcards            QueryExpandWildcards `json:"expand_wildcards,omitempty"`              // default: QueryExpandWildcardsOpen
	Explain                    bool                 `json:"explain,omitempty"`                       // default: false
	From                       int                  `json:"from,omitempty"`                          // default: 0
	IgnoreThrottled            bool                 `json:"ignore_throttled,omitempty"`              // default: false
	Lenient                    bool                 `json:"lenient,omitempty"`                       // default: false
	MaxConcurrentShardRequests int                  `json:"max_concurrent_shard_requests,omitempty"` // default: 5
	PreFilterShardSize         int                  `json:"pre_filter_shard_size,omitempty"`
	Preference                 string               `json:"preference,omitempty"`
	Q                          string               `json:"q,omitempty"`
	RequestCache               bool                 `json:"request_cache,omitempty"`
	RestTotalHitsAsInt         bool                 `json:"rest_total_hits_as_int,omitempty"` // default: false
	Routing                    string               `json:"routing,omitempty"`
	Scroll                     string               `json:"scroll,omitempty"`
	SearchType                 QuerySearchType      `json:"search_type,omitempty"` // default: QuerySearchTypeQueryThenFetch
	SeqNoPrimaryTerm           bool                 `json:"seq_no_primary_term,omitempty"`
	Size                       int                  `json:"size,omitempty"` // default: 10
	Sort                       SearchSortVal        `json:"sort,omitempty"`
	Source                     *SearchSourceVal     `json:"_source,omitempty"` // default: true
	SourceExcludes             StringList           `json:"_source_excludes,omitempty"`
	SourceIncludes             StringList           `json:"_source_includes,omitempty"`
	Stats                      string               `json:"stats,omitempty"`
	StoredFields               StringList           `json:"stored_fields,omitempty"`
	SuggestField               string               `json:"suggest_field,omitempty"`
	SuggestMode                SearchSuggestMode    `json:"suggest_mode,omitempty"` // default: SearchSuggestModeMissing
	SuggestSize                int                  `json:"suggest_size,omitempty"`
	SuggestText                string               `json:"suggest_text,omitempty"`
	TerminateAfter             int                  `json:"terminate_after,omitempty"` // default: 0
	Timeout                    string               `json:"timeout,omitempty"`
	TrackScores                bool                 `json:"track_scores,omitempty"`     // default: false
	TrackTotalHits             *TrackTotalHitsVal   `json:"track_total_hits,omitempty"` // default: 10000
	TypedKeys                  bool                 `json:"typed_keys,omitempty"`       // default: true
	Version                    bool                 `json:"version,omitempty"`          // default: false
}

type SearchSortVal

type SearchSortVal map[string]string

func (SearchSortVal) MarshalJSON

func (ssv SearchSortVal) MarshalJSON() ([]byte, error)

type SearchSourceVal

type SearchSourceVal struct {
	BoolValue bool
	Fields    StringList
}

func (*SearchSourceVal) MarshalJSON

func (ssv *SearchSourceVal) MarshalJSON() ([]byte, error)

type SearchSuggestMode

type SearchSuggestMode string
const (
	SearchSuggestModeAlways  SearchSuggestMode = "always"
	SearchSuggestModeMissing SearchSuggestMode = "missing"
	SearchSuggestModePopular SearchSuggestMode = "popular"
)

type SimpleQueryStringQuery

type SimpleQueryStringQuery func(query string, o ...func(all *tSimpleQueryStringQuery)) BaseQuery

SimpleQueryStringQuery results a simple_query_string struct

See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html

func NewSimpleQueryStringQuery

func NewSimpleQueryStringQuery() SimpleQueryStringQuery

func (*SimpleQueryStringQuery) WithAnalyzeWildcard

func (sqsq *SimpleQueryStringQuery) WithAnalyzeWildcard(analyzeWildcard bool) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithAnalyzer

func (sqsq *SimpleQueryStringQuery) WithAnalyzer(analyzer string) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithAutoGenerateSynonymsPhraseQuery

func (sqsq *SimpleQueryStringQuery) WithAutoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery bool) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithDefaultOperator

func (sqsq *SimpleQueryStringQuery) WithDefaultOperator(defaultOperator QueryOperator) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithFields

func (sqsq *SimpleQueryStringQuery) WithFields(fields ...string) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithFlags

func (sqsq *SimpleQueryStringQuery) WithFlags(flags ...QuerySimpleQueryStringFlag) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithFuzzyMaxExpansions

func (sqsq *SimpleQueryStringQuery) WithFuzzyMaxExpansions(FuzzyMaxExpansions int) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithFuzzyPrefixLength

func (sqsq *SimpleQueryStringQuery) WithFuzzyPrefixLength(FuzzyPrefixLength int) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithFuzzyTranspositions

func (sqsq *SimpleQueryStringQuery) WithFuzzyTranspositions(FuzzyTranspositions bool) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithLenient

func (sqsq *SimpleQueryStringQuery) WithLenient(Lenient bool) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithMinimumShouldMatch

func (sqsq *SimpleQueryStringQuery) WithMinimumShouldMatch(MinimumShouldMatch *MinimumShouldMatch) func(all *tSimpleQueryStringQuery)

func (*SimpleQueryStringQuery) WithQuoteFieldSuffix

func (sqsq *SimpleQueryStringQuery) WithQuoteFieldSuffix(QuoteFieldSuffix string) func(all *tSimpleQueryStringQuery)

type SimpleQueryStringQueryFlags

type SimpleQueryStringQueryFlags []QuerySimpleQueryStringFlag

func (SimpleQueryStringQueryFlags) MarshalJSON

func (flags SimpleQueryStringQueryFlags) MarshalJSON() ([]byte, error)

type StringList

type StringList []string

func (StringList) MarshalJSON

func (sl StringList) MarshalJSON() ([]byte, error)

type StringOrList

type StringOrList []string

func (StringOrList) MarshalJSON

func (sl StringOrList) MarshalJSON() ([]byte, error)

type StringQuery

type StringQuery struct {
	Query                           string        `json:"query"`
	DefaultField                    string        `json:"default_field,omitempty"`
	AllowLeadingWildcard            bool          `json:"allow_leading_wildcard,omitempty"` // default: true
	AnalyzeWildcard                 bool          `json:"analyze_wildcard,omitempty"`       // default: false
	Analyzer                        string        `json:"analyzer,omitempty"`
	AutoGenerateSynonymsPhraseQuery bool          `json:"auto_generate_synonyms_phrase_query,omitempty"`
	Boost                           float64       `json:"boost,omitempty"`                      // default: 1.0
	DefaultOperator                 QueryOperator `json:"default_operator,omitempty"`           // default: QueryOperatorOR
	EnablePositionIncrements        bool          `json:"enable_position_increments,omitempty"` // default: true
	Fields                          []string      `json:"fields,omitempty"`
	Fuzziness                       string        `json:"fuzziness,omitempty"`
	FuzzyMaxExpansions              int           `json:"fuzzy_max_expansions,omitempty"`    // default: 50
	FuzzyPrefixLength               int           `json:"fuzzy_prefix_length,omitempty"`     // default: 0
	FuzzyTranspositions             bool          `json:"fuzzy_transpositions,omitempty"`    // default: true
	Lenient                         bool          `json:"lenient,omitempty"`                 // default: false
	MaxDeterminizedStates           int           `json:"max_determinized_states,omitempty"` // default: 10000
	MinimumShouldMatch              string        `json:"minimum_should_match,omitempty"`
	QuoteAnalyzer                   string        `json:"quote_analyzer,omitempty"`
	PhraseSlop                      int           `json:"phrase_slop,omitempty"` // default: 0
	QuoteFieldSuffix                string        `json:"quote_field_suffix,omitempty"`
	Rewrite                         string        `json:"rewrite,omitempty"`
	TimeZone                        string        `json:"time_zone,omitempty"`
}

func (*StringQuery) GetQueryName

func (*StringQuery) GetQueryName() string

type TermQuery

type TermQuery func(field string, value string, o ...func(all *tTermQuery)) BaseQuery

TermQuery return a term structure

See complete documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html

func NewTermQuery

func NewTermQuery() TermQuery

func (*TermQuery) WithBoost

func (q *TermQuery) WithBoost(boost float64) func(all *tTermQuery)

func (*TermQuery) WithCaseInsensitiv

func (q *TermQuery) WithCaseInsensitiv(caseInsensitive bool) func(all *tTermQuery)

type TermsQuery

type TermsQuery func(field string, values []string, o ...func(all *tTermsQuery)) BaseQuery

TermsQuery return a terms structure

See complete documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html

func NewTermsQuery

func NewTermsQuery() TermsQuery

func (*TermsQuery) WithBoost

func (q *TermsQuery) WithBoost(boost float64) func(all *tTermsQuery)

func (*TermsQuery) WithCaseInsensitiv

func (q *TermsQuery) WithCaseInsensitiv(caseInsensitive bool) func(all *tTermsQuery)

type TrackTotalHitsVal

type TrackTotalHitsVal struct {
	IntVal  int
	BoolVal bool
}

func (*TrackTotalHitsVal) MarshalJSON

func (tthv *TrackTotalHitsVal) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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