query

package
v0.0.0-...-e779149 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregations

type Aggregations struct {
	*CardinalityAggregation   `json:"cardinality_aggregation,omitempty"`
	*DateHistogramAggregation `json:"date_histogram_aggregation,omitempty"`
}

func NewAggregations

func NewAggregations() *Aggregations

func (*Aggregations) WithCardinalityAggregation

func (a *Aggregations) WithCardinalityAggregation(field string) *Aggregations

func (*Aggregations) WithDateHistogramAggregation

func (a *Aggregations) WithDateHistogramAggregation(field string, interval string) *Aggregations

type Bool

type Bool struct {
	*Parameter `json:"bool,omitempty"`
}

Example: {bool: {filter: <[]Match>}} {bool: {should: <[]Match>, minimum_should_match: 1}}

func NewBool

func NewBool() *Bool

func (*Bool) AppendFilter

func (b *Bool) AppendFilter(item Item) *Bool

func (*Bool) AppendMultiFilter

func (b *Bool) AppendMultiFilter(items []Item) *Bool

func (*Bool) AppendMultiMustNot

func (b *Bool) AppendMultiMustNot(items []Item) *Bool

func (*Bool) AppendMultiShould

func (b *Bool) AppendMultiShould(items []Item) *Bool

func (*Bool) AppendMustNot

func (b *Bool) AppendMustNot(item Item) *Bool

func (*Bool) AppendShould

func (b *Bool) AppendShould(item Item) *Bool

func (*Bool) IsValid

func (b *Bool) IsValid() bool

func (*Bool) WithMinimumShouldMatch

func (b *Bool) WithMinimumShouldMatch(min int32) *Bool

type Builder

type Builder struct {
	From          int64               `json:"from,omitempty"`
	Size          int64               `json:"size,omitempty"`
	Sorts         []map[string]string `json:"sort,omitempty"`
	*Query        `json:",inline"`
	*Aggregations `json:"aggs,omitempty"`
}

TODO: elastic/go-elasticsearch is working on Query DSL support.

See https://github.com/elastic/go-elasticsearch/issues/42.
We need refactor our query body builder when that is ready.

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Bytes

func (b *Builder) Bytes() ([]byte, error)

func (*Builder) WithAggregations

func (b *Builder) WithAggregations(aggs *Aggregations) *Builder

func (*Builder) WithFrom

func (b *Builder) WithFrom(n int64) *Builder

func (*Builder) WithQuery

func (b *Builder) WithQuery(q *Query) *Builder

func (*Builder) WithSize

func (b *Builder) WithSize(n int64) *Builder

func (*Builder) WithSort

func (b *Builder) WithSort(key, order string) *Builder

type Cardinality

type Cardinality struct {
	Field string `json:"field,omitempty"`
}

type CardinalityAggregation

type CardinalityAggregation struct {
	*Cardinality `json:"cardinality,omitempty"`
}

type DateHistogram

type DateHistogram struct {
	Field    string `json:"field,omitempty"`
	Interval string `json:"interval,omitempty"`
}

type DateHistogramAggregation

type DateHistogramAggregation struct {
	*DateHistogram `json:"date_histogram,omitempty"`
}

type Exists

type Exists struct {
	Exists map[string]string `json:"exists,omitempty"`
}

func NewExists

func NewExists(key, val string) *Exists

func (*Exists) IsValid

func (m *Exists) IsValid() bool

type Item

type Item interface {
	IsValid() bool
}

func NewMultiMatchPhrase

func NewMultiMatchPhrase(key string, val []string) []Item

func NewMultiMatchPhrasePrefix

func NewMultiMatchPhrasePrefix(key string, val []string) []Item

func NewMultiWildcard

func NewMultiWildcard(key string, val []string) []Item

type MatchPhrase

type MatchPhrase struct {
	MatchPhrase map[string]string `json:"match_phrase,omitempty"`
}

func NewMatchPhrase

func NewMatchPhrase(key, val string) *MatchPhrase

func (*MatchPhrase) IsValid

func (m *MatchPhrase) IsValid() bool

type MatchPhrasePrefix

type MatchPhrasePrefix struct {
	MatchPhrasePrefix map[string]string `json:"match_phrase_prefix,omitempty"`
}

func NewMatchPhrasePrefix

func NewMatchPhrasePrefix(key, val string) *MatchPhrasePrefix

func (*MatchPhrasePrefix) IsValid

func (m *MatchPhrasePrefix) IsValid() bool

type Parameter

type Parameter struct {
	Filter             []interface{} `json:"filter,omitempty"`
	Should             []interface{} `json:"should,omitempty"`
	MustNot            []interface{} `json:"must_not,omitempty"`
	MinimumShouldMatch int32         `json:"minimum_should_match,omitempty"`
}

type Query

type Query struct {
	*Bool `json:"query,omitempty"`
}

func NewQuery

func NewQuery() *Query

func (*Query) WithBool

func (q *Query) WithBool(b *Bool) *Query

type Range

type Range struct {
	Range map[string]map[string]interface{} `json:"range,omitempty"`
}

func NewRange

func NewRange(key string) *Range

func (*Range) IsValid

func (r *Range) IsValid() bool

func (*Range) WithGT

func (r *Range) WithGT(val interface{}) *Range

func (*Range) WithGTE

func (r *Range) WithGTE(val interface{}) *Range

func (*Range) WithLT

func (r *Range) WithLT(val interface{}) *Range

func (*Range) WithLTE

func (r *Range) WithLTE(val interface{}) *Range

type Regexp

type Regexp struct {
	Regexp map[string]string `json:"regexp,omitempty"`
}

func NewRegex

func NewRegex(key, val string) *Regexp

func (*Regexp) IsValid

func (m *Regexp) IsValid() bool

type Terms

type Terms struct {
	Terms map[string]interface{} `json:"terms,omitempty"`
}

func NewTerms

func NewTerms(key string, val interface{}) *Terms

func (*Terms) IsValid

func (m *Terms) IsValid() bool

type Wildcard

type Wildcard struct {
	Wildcard map[string]string `json:"wildcard,omitempty"`
}

func NewWildcard

func NewWildcard(key, val string) *Wildcard

func (*Wildcard) IsValid

func (m *Wildcard) IsValid() bool

Jump to

Keyboard shortcuts

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