Documentation
¶
Overview ¶
Package query provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type BoolFieldQuery
- type BooleanQuery
- type Boost
- type Client
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- type ClientWithResponsesInterface
- type ConjunctionQuery
- type DateRangeStringQuery
- type DisjunctionQuery
- type DocIdQuery
- type Fuzziness
- func (t Fuzziness) AsFuzziness0() (Fuzziness0, error)
- func (t Fuzziness) AsFuzziness1() (Fuzziness1, error)
- func (t *Fuzziness) FromFuzziness0(v Fuzziness0) error
- func (t *Fuzziness) FromFuzziness1(v Fuzziness1) error
- func (t Fuzziness) MarshalJSON() ([]byte, error)
- func (t *Fuzziness) MergeFuzziness0(v Fuzziness0) error
- func (t *Fuzziness) MergeFuzziness1(v Fuzziness1) error
- func (t *Fuzziness) UnmarshalJSON(b []byte) error
- type Fuzziness0
- type Fuzziness1
- type FuzzyQuery
- type GeoBoundingBoxQuery
- type GeoBoundingPolygonQuery
- type GeoDistanceQuery
- type GeoPoint
- type GeoShape
- type GeoShapeGeometry
- type GeoShapeGeometryRelation
- type GeoShapeQuery
- type HttpRequestDoer
- type IPRangeQuery
- type MatchAllQuery
- type MatchNoneQuery
- type MatchPhraseQuery
- type MatchQuery
- type MatchQueryOperator
- type MultiPhraseQuery
- type NumericRangeQuery
- type PhraseQuery
- type PrefixQuery
- type Query
- func NewBoolean(must ConjunctionQuery, should DisjunctionQuery, mustNot DisjunctionQuery) Query
- func NewDateRange(start time.Time, end time.Time, field string) Query
- func NewDocIds(ids []string) Query
- func NewGeoBoundingBox(topLeftLon float64, topLeftLat float64, bottomRightLon float64, ...) Query
- func NewGeoDistance(lon float64, lat float64, distance string, field string) Query
- func NewMatch(match string, field string) Query
- func NewMatchAll() Query
- func NewMatchNone() Query
- func NewMatchPhrase(phrase string, field string) Query
- func NewNumericRange(min float64, max float64, field string) Query
- func NewPrefix(prefix string, field string) Query
- func NewQueryString(queryStr string) Query
- func NewQueryStringBoost(queryStr string, boost float64) Query
- func NewTerm(term string, field string) Query
- func (t Query) AsBoolFieldQuery() (BoolFieldQuery, error)
- func (t Query) AsBooleanQuery() (BooleanQuery, error)
- func (t Query) AsConjunctionQuery() (ConjunctionQuery, error)
- func (t Query) AsDateRangeStringQuery() (DateRangeStringQuery, error)
- func (t Query) AsDisjunctionQuery() (DisjunctionQuery, error)
- func (t Query) AsDocIdQuery() (DocIdQuery, error)
- func (t Query) AsFuzzyQuery() (FuzzyQuery, error)
- func (t Query) AsGeoBoundingBoxQuery() (GeoBoundingBoxQuery, error)
- func (t Query) AsGeoBoundingPolygonQuery() (GeoBoundingPolygonQuery, error)
- func (t Query) AsGeoDistanceQuery() (GeoDistanceQuery, error)
- func (t Query) AsGeoShapeQuery() (GeoShapeQuery, error)
- func (t Query) AsIPRangeQuery() (IPRangeQuery, error)
- func (t Query) AsMatchAllQuery() (MatchAllQuery, error)
- func (t Query) AsMatchNoneQuery() (MatchNoneQuery, error)
- func (t Query) AsMatchPhraseQuery() (MatchPhraseQuery, error)
- func (t Query) AsMatchQuery() (MatchQuery, error)
- func (t Query) AsMultiPhraseQuery() (MultiPhraseQuery, error)
- func (t Query) AsNumericRangeQuery() (NumericRangeQuery, error)
- func (t Query) AsPhraseQuery() (PhraseQuery, error)
- func (t Query) AsPrefixQuery() (PrefixQuery, error)
- func (t Query) AsQueryStringQuery() (QueryStringQuery, error)
- func (t Query) AsRegexpQuery() (RegexpQuery, error)
- func (t Query) AsTermQuery() (TermQuery, error)
- func (t Query) AsTermRangeQuery() (TermRangeQuery, error)
- func (t Query) AsWildcardQuery() (WildcardQuery, error)
- func (t *Query) FromBoolFieldQuery(v BoolFieldQuery) error
- func (t *Query) FromBooleanQuery(v BooleanQuery) error
- func (t *Query) FromConjunctionQuery(v ConjunctionQuery) error
- func (t *Query) FromDateRangeStringQuery(v DateRangeStringQuery) error
- func (t *Query) FromDisjunctionQuery(v DisjunctionQuery) error
- func (t *Query) FromDocIdQuery(v DocIdQuery) error
- func (t *Query) FromFuzzyQuery(v FuzzyQuery) error
- func (t *Query) FromGeoBoundingBoxQuery(v GeoBoundingBoxQuery) error
- func (t *Query) FromGeoBoundingPolygonQuery(v GeoBoundingPolygonQuery) error
- func (t *Query) FromGeoDistanceQuery(v GeoDistanceQuery) error
- func (t *Query) FromGeoShapeQuery(v GeoShapeQuery) error
- func (t *Query) FromIPRangeQuery(v IPRangeQuery) error
- func (t *Query) FromMatchAllQuery(v MatchAllQuery) error
- func (t *Query) FromMatchNoneQuery(v MatchNoneQuery) error
- func (t *Query) FromMatchPhraseQuery(v MatchPhraseQuery) error
- func (t *Query) FromMatchQuery(v MatchQuery) error
- func (t *Query) FromMultiPhraseQuery(v MultiPhraseQuery) error
- func (t *Query) FromNumericRangeQuery(v NumericRangeQuery) error
- func (t *Query) FromPhraseQuery(v PhraseQuery) error
- func (t *Query) FromPrefixQuery(v PrefixQuery) error
- func (t *Query) FromQueryStringQuery(v QueryStringQuery) error
- func (t *Query) FromRegexpQuery(v RegexpQuery) error
- func (t *Query) FromTermQuery(v TermQuery) error
- func (t *Query) FromTermRangeQuery(v TermRangeQuery) error
- func (t *Query) FromWildcardQuery(v WildcardQuery) error
- func (t Query) MarshalJSON() ([]byte, error)
- func (t *Query) MergeBoolFieldQuery(v BoolFieldQuery) error
- func (t *Query) MergeBooleanQuery(v BooleanQuery) error
- func (t *Query) MergeConjunctionQuery(v ConjunctionQuery) error
- func (t *Query) MergeDateRangeStringQuery(v DateRangeStringQuery) error
- func (t *Query) MergeDisjunctionQuery(v DisjunctionQuery) error
- func (t *Query) MergeDocIdQuery(v DocIdQuery) error
- func (t *Query) MergeFuzzyQuery(v FuzzyQuery) error
- func (t *Query) MergeGeoBoundingBoxQuery(v GeoBoundingBoxQuery) error
- func (t *Query) MergeGeoBoundingPolygonQuery(v GeoBoundingPolygonQuery) error
- func (t *Query) MergeGeoDistanceQuery(v GeoDistanceQuery) error
- func (t *Query) MergeGeoShapeQuery(v GeoShapeQuery) error
- func (t *Query) MergeIPRangeQuery(v IPRangeQuery) error
- func (t *Query) MergeMatchAllQuery(v MatchAllQuery) error
- func (t *Query) MergeMatchNoneQuery(v MatchNoneQuery) error
- func (t *Query) MergeMatchPhraseQuery(v MatchPhraseQuery) error
- func (t *Query) MergeMatchQuery(v MatchQuery) error
- func (t *Query) MergeMultiPhraseQuery(v MultiPhraseQuery) error
- func (t *Query) MergeNumericRangeQuery(v NumericRangeQuery) error
- func (t *Query) MergePhraseQuery(v PhraseQuery) error
- func (t *Query) MergePrefixQuery(v PrefixQuery) error
- func (t *Query) MergeQueryStringQuery(v QueryStringQuery) error
- func (t *Query) MergeRegexpQuery(v RegexpQuery) error
- func (t *Query) MergeTermQuery(v TermQuery) error
- func (t *Query) MergeTermRangeQuery(v TermRangeQuery) error
- func (t *Query) MergeWildcardQuery(v WildcardQuery) error
- func (t *Query) UnmarshalJSON(b []byte) error
- type QueryStringQuery
- type RegexpQuery
- type RequestEditorFn
- type TermQuery
- type TermRangeQuery
- type WildcardQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
Types ¶
type BoolFieldQuery ¶
type BoolFieldQuery struct {
Bool bool `json:"bool"`
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
}
BoolFieldQuery defines model for BoolFieldQuery.
func (BoolFieldQuery) ToQuery ¶
func (v BoolFieldQuery) ToQuery() Query
ToQuery creates a Query from a BoolFieldQuery. Panics on error.
type BooleanQuery ¶
type BooleanQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Filter Query `json:"filter,omitempty,omitzero"`
Must ConjunctionQuery `json:"must,omitempty,omitzero"`
MustNot DisjunctionQuery `json:"must_not,omitempty,omitzero"`
Should DisjunctionQuery `json:"should,omitempty,omitzero"`
}
BooleanQuery defines model for BooleanQuery.
func (BooleanQuery) ToQuery ¶
func (v BooleanQuery) ToQuery() Query
ToQuery creates a Query from a BooleanQuery. Panics on error.
type Boost ¶
type Boost = float64
Boost A floating-point number used to decrease or increase the relevance scores of a query.
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
type ClientInterface ¶
type ClientInterface interface {
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type ConjunctionQuery ¶
type ConjunctionQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Conjuncts []Query `json:"conjuncts"`
}
ConjunctionQuery defines model for ConjunctionQuery.
func NewConjunction ¶
func NewConjunction(queries []Query) ConjunctionQuery
NewConjunction creates a ConjunctionQuery (AND).
Example:
q := query.NewConjunction([]query.Query{
query.NewTerm("published", "status"),
query.NewMatch("golang", "title"),
})
func (ConjunctionQuery) ToQuery ¶
func (v ConjunctionQuery) ToQuery() Query
ToQuery creates a Query from a ConjunctionQuery. Panics on error.
type DateRangeStringQuery ¶
type DateRangeStringQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
DatetimeParser string `json:"datetime_parser,omitempty,omitzero"`
End time.Time `json:"end,omitempty,omitzero"`
Field string `json:"field,omitempty,omitzero"`
InclusiveEnd bool `json:"inclusive_end,omitzero"`
InclusiveStart bool `json:"inclusive_start,omitzero"`
Start time.Time `json:"start,omitempty,omitzero"`
}
DateRangeStringQuery defines model for DateRangeStringQuery.
func (DateRangeStringQuery) ToQuery ¶
func (v DateRangeStringQuery) ToQuery() Query
ToQuery creates a Query from a DateRangeStringQuery. Panics on error.
type DisjunctionQuery ¶
type DisjunctionQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Disjuncts []Query `json:"disjuncts"`
Min float64 `json:"min,omitempty,omitzero"`
}
DisjunctionQuery defines model for DisjunctionQuery.
func NewDisjunction ¶
func NewDisjunction(queries []Query, min float64) DisjunctionQuery
NewDisjunction creates a DisjunctionQuery (OR).
Example:
q := query.NewDisjunction([]query.Query{
query.NewTerm("draft", "status"),
query.NewTerm("pending", "status"),
}, 0)
func (DisjunctionQuery) ToQuery ¶
func (v DisjunctionQuery) ToQuery() Query
ToQuery creates a Query from a DisjunctionQuery. Panics on error.
type DocIdQuery ¶
type DocIdQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Ids []string `json:"ids"`
}
DocIdQuery defines model for DocIdQuery.
func (DocIdQuery) ToQuery ¶
func (v DocIdQuery) ToQuery() Query
ToQuery creates a Query from a DocIdQuery. Panics on error.
type Fuzziness ¶
type Fuzziness struct {
// contains filtered or unexported fields
}
Fuzziness The fuzziness of the query. Can be an integer or "auto".
func FuzzinessInt ¶
FuzzinessInt creates a Fuzziness from an int32. Panics on error.
func FuzzinessStr ¶
FuzzinessStr creates a Fuzziness from a string. Panics on error.
func (Fuzziness) AsFuzziness0 ¶
func (t Fuzziness) AsFuzziness0() (Fuzziness0, error)
AsFuzziness0 returns the union data inside the Fuzziness as a Fuzziness0
func (Fuzziness) AsFuzziness1 ¶
func (t Fuzziness) AsFuzziness1() (Fuzziness1, error)
AsFuzziness1 returns the union data inside the Fuzziness as a Fuzziness1
func (*Fuzziness) FromFuzziness0 ¶
func (t *Fuzziness) FromFuzziness0(v Fuzziness0) error
FromFuzziness0 overwrites any union data inside the Fuzziness as the provided Fuzziness0
func (*Fuzziness) FromFuzziness1 ¶
func (t *Fuzziness) FromFuzziness1(v Fuzziness1) error
FromFuzziness1 overwrites any union data inside the Fuzziness as the provided Fuzziness1
func (Fuzziness) MarshalJSON ¶
func (*Fuzziness) MergeFuzziness0 ¶
func (t *Fuzziness) MergeFuzziness0(v Fuzziness0) error
MergeFuzziness0 performs a merge with any union data inside the Fuzziness, using the provided Fuzziness0
func (*Fuzziness) MergeFuzziness1 ¶
func (t *Fuzziness) MergeFuzziness1(v Fuzziness1) error
MergeFuzziness1 performs a merge with any union data inside the Fuzziness, using the provided Fuzziness1
func (*Fuzziness) UnmarshalJSON ¶
type Fuzziness1 ¶
type Fuzziness1 string
Fuzziness1 defines model for Fuzziness.1.
const (
Fuzziness1Auto Fuzziness1 = "auto"
)
Defines values for Fuzziness1.
type FuzzyQuery ¶
type FuzzyQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
// Fuzziness The fuzziness of the query. Can be an integer or "auto".
Fuzziness Fuzziness `json:"fuzziness,omitempty,omitzero"`
PrefixLength int32 `json:"prefix_length,omitempty,omitzero"`
Term string `json:"term"`
}
FuzzyQuery defines model for FuzzyQuery.
func (FuzzyQuery) ToQuery ¶
func (v FuzzyQuery) ToQuery() Query
ToQuery creates a Query from a FuzzyQuery. Panics on error.
type GeoBoundingBoxQuery ¶
type GeoBoundingBoxQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
// BottomRight [lon, lat]
BottomRight []float64 `json:"bottom_right"`
Field string `json:"field,omitempty,omitzero"`
// TopLeft [lon, lat]
TopLeft []float64 `json:"top_left"`
}
GeoBoundingBoxQuery defines model for GeoBoundingBoxQuery.
func (GeoBoundingBoxQuery) ToQuery ¶
func (v GeoBoundingBoxQuery) ToQuery() Query
ToQuery creates a Query from a GeoBoundingBoxQuery. Panics on error.
type GeoBoundingPolygonQuery ¶
type GeoBoundingPolygonQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
PolygonPoints []GeoPoint `json:"polygon_points"`
}
GeoBoundingPolygonQuery defines model for GeoBoundingPolygonQuery.
func (GeoBoundingPolygonQuery) ToQuery ¶
func (v GeoBoundingPolygonQuery) ToQuery() Query
ToQuery creates a Query from a GeoBoundingPolygonQuery. Panics on error.
type GeoDistanceQuery ¶
type GeoDistanceQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Distance string `json:"distance"`
Field string `json:"field,omitempty,omitzero"`
// Location [lon, lat]
Location []float64 `json:"location"`
}
GeoDistanceQuery defines model for GeoDistanceQuery.
func (GeoDistanceQuery) ToQuery ¶
func (v GeoDistanceQuery) ToQuery() Query
ToQuery creates a Query from a GeoDistanceQuery. Panics on error.
type GeoPoint ¶
type GeoPoint struct {
Lat float64 `json:"lat,omitempty,omitzero"`
Lon float64 `json:"lon,omitempty,omitzero"`
}
GeoPoint defines model for GeoPoint.
type GeoShape ¶
type GeoShape struct {
Coordinates []interface{} `json:"coordinates"`
Type string `json:"type"`
}
GeoShape A GeoJSON shape object. This is a simplified representation.
type GeoShapeGeometry ¶
type GeoShapeGeometry struct {
Relation GeoShapeGeometryRelation `json:"relation"`
// Shape A GeoJSON shape object. This is a simplified representation.
Shape GeoShape `json:"shape"`
}
GeoShapeGeometry defines model for GeoShapeGeometry.
type GeoShapeGeometryRelation ¶
type GeoShapeGeometryRelation string
GeoShapeGeometryRelation defines model for GeoShapeGeometry.Relation.
const ( GeoShapeGeometryRelationContains GeoShapeGeometryRelation = "contains" GeoShapeGeometryRelationIntersects GeoShapeGeometryRelation = "intersects" GeoShapeGeometryRelationWithin GeoShapeGeometryRelation = "within" )
Defines values for GeoShapeGeometryRelation.
type GeoShapeQuery ¶
type GeoShapeQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
Geometry GeoShapeGeometry `json:"geometry"`
}
GeoShapeQuery defines model for GeoShapeQuery.
func (GeoShapeQuery) ToQuery ¶
func (v GeoShapeQuery) ToQuery() Query
ToQuery creates a Query from a GeoShapeQuery. Panics on error.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type IPRangeQuery ¶
type IPRangeQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Cidr string `json:"cidr"`
Field string `json:"field,omitempty,omitzero"`
}
IPRangeQuery defines model for IPRangeQuery.
func (IPRangeQuery) ToQuery ¶
func (v IPRangeQuery) ToQuery() Query
ToQuery creates a Query from a IPRangeQuery. Panics on error.
type MatchAllQuery ¶
type MatchAllQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
MatchAll map[string]interface{} `json:"match_all"`
}
MatchAllQuery defines model for MatchAllQuery.
func (MatchAllQuery) ToQuery ¶
func (v MatchAllQuery) ToQuery() Query
ToQuery creates a Query from a MatchAllQuery. Panics on error.
type MatchNoneQuery ¶
type MatchNoneQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
MatchNone map[string]interface{} `json:"match_none"`
}
MatchNoneQuery defines model for MatchNoneQuery.
func (MatchNoneQuery) ToQuery ¶
func (v MatchNoneQuery) ToQuery() Query
ToQuery creates a Query from a MatchNoneQuery. Panics on error.
type MatchPhraseQuery ¶
type MatchPhraseQuery struct {
Analyzer string `json:"analyzer,omitempty,omitzero"`
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
// Fuzziness The fuzziness of the query. Can be an integer or "auto".
Fuzziness Fuzziness `json:"fuzziness,omitempty,omitzero"`
MatchPhrase string `json:"match_phrase"`
}
MatchPhraseQuery defines model for MatchPhraseQuery.
func (MatchPhraseQuery) ToQuery ¶
func (v MatchPhraseQuery) ToQuery() Query
ToQuery creates a Query from a MatchPhraseQuery. Panics on error.
type MatchQuery ¶
type MatchQuery struct {
Analyzer string `json:"analyzer,omitempty,omitzero"`
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
// Fuzziness The fuzziness of the query. Can be an integer or "auto".
Fuzziness Fuzziness `json:"fuzziness,omitempty,omitzero"`
Match string `json:"match"`
Operator MatchQueryOperator `json:"operator,omitempty,omitzero"`
PrefixLength int32 `json:"prefix_length,omitempty,omitzero"`
}
MatchQuery defines model for MatchQuery.
func (MatchQuery) ToQuery ¶
func (v MatchQuery) ToQuery() Query
ToQuery creates a Query from a MatchQuery. Panics on error.
type MatchQueryOperator ¶
type MatchQueryOperator string
MatchQueryOperator defines model for MatchQuery.Operator.
const ( MatchQueryOperatorAnd MatchQueryOperator = "and" MatchQueryOperatorOr MatchQueryOperator = "or" )
Defines values for MatchQueryOperator.
type MultiPhraseQuery ¶
type MultiPhraseQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
// Fuzziness The fuzziness of the query. Can be an integer or "auto".
Fuzziness Fuzziness `json:"fuzziness,omitempty,omitzero"`
Terms [][]string `json:"terms"`
}
MultiPhraseQuery defines model for MultiPhraseQuery.
func (MultiPhraseQuery) ToQuery ¶
func (v MultiPhraseQuery) ToQuery() Query
ToQuery creates a Query from a MultiPhraseQuery. Panics on error.
type NumericRangeQuery ¶
type NumericRangeQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
InclusiveMax bool `json:"inclusive_max,omitzero"`
InclusiveMin bool `json:"inclusive_min,omitzero"`
Max float64 `json:"max,omitzero"`
Min float64 `json:"min,omitzero"`
}
NumericRangeQuery defines model for NumericRangeQuery.
func (NumericRangeQuery) ToQuery ¶
func (v NumericRangeQuery) ToQuery() Query
ToQuery creates a Query from a NumericRangeQuery. Panics on error.
type PhraseQuery ¶
type PhraseQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
// Fuzziness The fuzziness of the query. Can be an integer or "auto".
Fuzziness Fuzziness `json:"fuzziness,omitempty,omitzero"`
Terms []string `json:"terms"`
}
PhraseQuery defines model for PhraseQuery.
func (PhraseQuery) ToQuery ¶
func (v PhraseQuery) ToQuery() Query
ToQuery creates a Query from a PhraseQuery. Panics on error.
type PrefixQuery ¶
type PrefixQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
Prefix string `json:"prefix"`
}
PrefixQuery defines model for PrefixQuery.
func (PrefixQuery) ToQuery ¶
func (v PrefixQuery) ToQuery() Query
ToQuery creates a Query from a PrefixQuery. Panics on error.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query defines model for Query.
func NewBoolean ¶
func NewBoolean(must ConjunctionQuery, should DisjunctionQuery, mustNot DisjunctionQuery) Query
NewBoolean creates a BooleanQuery.
Example:
must := query.NewConjunction([]query.Query{query.NewTerm("published", "status")})
mustNot := query.NewDisjunction([]query.Query{query.NewTerm("archived", "status")}, 0)
q := query.NewBoolean(must, DisjunctionQuery{}, mustNot)
func NewDateRange ¶
NewDateRange creates a DateRangeStringQuery.
Example:
start := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) end := time.Date(2024, 12, 31, 23, 59, 59, 0, time.UTC) q := query.NewDateRange(start, end, "created_at")
func NewDocIds ¶
NewDocIds creates a DocIdQuery.
Example:
q := query.NewDocIds([]string{"doc1", "doc2", "doc3"})
func NewGeoBoundingBox ¶
func NewGeoBoundingBox(topLeftLon float64, topLeftLat float64, bottomRightLon float64, bottomRightLat float64, field string) Query
NewGeoBoundingBox creates a GeoBoundingBoxQuery.
Example:
q := query.NewGeoBoundingBox(
-122.5, 37.9, // top left lon, lat
-122.3, 37.7, // bottom right lon, lat
"location",
)
func NewGeoDistance ¶
NewGeoDistance creates a GeoDistanceQuery.
Example:
q := query.NewGeoDistance(-122.4, 37.8, "5km", "location")
func NewMatch ¶
NewMatch creates a MatchQuery.
Example:
q := query.NewMatch("golang tutorial", "body")
func NewMatchAll ¶
func NewMatchAll() Query
NewMatchAll creates a MatchAllQuery.
Example:
q := query.NewMatchAll()
func NewMatchNone ¶
func NewMatchNone() Query
NewMatchNone creates a MatchNoneQuery.
Example:
q := query.NewMatchNone()
func NewMatchPhrase ¶
NewMatchPhrase creates a MatchPhraseQuery.
Example:
q := query.NewMatchPhrase("distributed systems", "body")
func NewNumericRange ¶
NewNumericRange creates a NumericRangeQuery.
Example:
q := query.NewNumericRange(0, 1000, "price")
func NewQueryString ¶
NewQueryString creates a QueryStringQuery.
Example:
q := query.NewQueryString("body:computer AND category:technology")
func NewQueryStringBoost ¶
NewQueryStringBoost creates a QueryStringQuery with boost.
Example:
q := query.NewQueryStringBoost("body:computer", 1.5)
func (Query) AsBoolFieldQuery ¶
func (t Query) AsBoolFieldQuery() (BoolFieldQuery, error)
AsBoolFieldQuery returns the union data inside the Query as a BoolFieldQuery
func (Query) AsBooleanQuery ¶
func (t Query) AsBooleanQuery() (BooleanQuery, error)
AsBooleanQuery returns the union data inside the Query as a BooleanQuery
func (Query) AsConjunctionQuery ¶
func (t Query) AsConjunctionQuery() (ConjunctionQuery, error)
AsConjunctionQuery returns the union data inside the Query as a ConjunctionQuery
func (Query) AsDateRangeStringQuery ¶
func (t Query) AsDateRangeStringQuery() (DateRangeStringQuery, error)
AsDateRangeStringQuery returns the union data inside the Query as a DateRangeStringQuery
func (Query) AsDisjunctionQuery ¶
func (t Query) AsDisjunctionQuery() (DisjunctionQuery, error)
AsDisjunctionQuery returns the union data inside the Query as a DisjunctionQuery
func (Query) AsDocIdQuery ¶
func (t Query) AsDocIdQuery() (DocIdQuery, error)
AsDocIdQuery returns the union data inside the Query as a DocIdQuery
func (Query) AsFuzzyQuery ¶
func (t Query) AsFuzzyQuery() (FuzzyQuery, error)
AsFuzzyQuery returns the union data inside the Query as a FuzzyQuery
func (Query) AsGeoBoundingBoxQuery ¶
func (t Query) AsGeoBoundingBoxQuery() (GeoBoundingBoxQuery, error)
AsGeoBoundingBoxQuery returns the union data inside the Query as a GeoBoundingBoxQuery
func (Query) AsGeoBoundingPolygonQuery ¶
func (t Query) AsGeoBoundingPolygonQuery() (GeoBoundingPolygonQuery, error)
AsGeoBoundingPolygonQuery returns the union data inside the Query as a GeoBoundingPolygonQuery
func (Query) AsGeoDistanceQuery ¶
func (t Query) AsGeoDistanceQuery() (GeoDistanceQuery, error)
AsGeoDistanceQuery returns the union data inside the Query as a GeoDistanceQuery
func (Query) AsGeoShapeQuery ¶
func (t Query) AsGeoShapeQuery() (GeoShapeQuery, error)
AsGeoShapeQuery returns the union data inside the Query as a GeoShapeQuery
func (Query) AsIPRangeQuery ¶
func (t Query) AsIPRangeQuery() (IPRangeQuery, error)
AsIPRangeQuery returns the union data inside the Query as a IPRangeQuery
func (Query) AsMatchAllQuery ¶
func (t Query) AsMatchAllQuery() (MatchAllQuery, error)
AsMatchAllQuery returns the union data inside the Query as a MatchAllQuery
func (Query) AsMatchNoneQuery ¶
func (t Query) AsMatchNoneQuery() (MatchNoneQuery, error)
AsMatchNoneQuery returns the union data inside the Query as a MatchNoneQuery
func (Query) AsMatchPhraseQuery ¶
func (t Query) AsMatchPhraseQuery() (MatchPhraseQuery, error)
AsMatchPhraseQuery returns the union data inside the Query as a MatchPhraseQuery
func (Query) AsMatchQuery ¶
func (t Query) AsMatchQuery() (MatchQuery, error)
AsMatchQuery returns the union data inside the Query as a MatchQuery
func (Query) AsMultiPhraseQuery ¶
func (t Query) AsMultiPhraseQuery() (MultiPhraseQuery, error)
AsMultiPhraseQuery returns the union data inside the Query as a MultiPhraseQuery
func (Query) AsNumericRangeQuery ¶
func (t Query) AsNumericRangeQuery() (NumericRangeQuery, error)
AsNumericRangeQuery returns the union data inside the Query as a NumericRangeQuery
func (Query) AsPhraseQuery ¶
func (t Query) AsPhraseQuery() (PhraseQuery, error)
AsPhraseQuery returns the union data inside the Query as a PhraseQuery
func (Query) AsPrefixQuery ¶
func (t Query) AsPrefixQuery() (PrefixQuery, error)
AsPrefixQuery returns the union data inside the Query as a PrefixQuery
func (Query) AsQueryStringQuery ¶
func (t Query) AsQueryStringQuery() (QueryStringQuery, error)
AsQueryStringQuery returns the union data inside the Query as a QueryStringQuery
func (Query) AsRegexpQuery ¶
func (t Query) AsRegexpQuery() (RegexpQuery, error)
AsRegexpQuery returns the union data inside the Query as a RegexpQuery
func (Query) AsTermQuery ¶
AsTermQuery returns the union data inside the Query as a TermQuery
func (Query) AsTermRangeQuery ¶
func (t Query) AsTermRangeQuery() (TermRangeQuery, error)
AsTermRangeQuery returns the union data inside the Query as a TermRangeQuery
func (Query) AsWildcardQuery ¶
func (t Query) AsWildcardQuery() (WildcardQuery, error)
AsWildcardQuery returns the union data inside the Query as a WildcardQuery
func (*Query) FromBoolFieldQuery ¶
func (t *Query) FromBoolFieldQuery(v BoolFieldQuery) error
FromBoolFieldQuery overwrites any union data inside the Query as the provided BoolFieldQuery
func (*Query) FromBooleanQuery ¶
func (t *Query) FromBooleanQuery(v BooleanQuery) error
FromBooleanQuery overwrites any union data inside the Query as the provided BooleanQuery
func (*Query) FromConjunctionQuery ¶
func (t *Query) FromConjunctionQuery(v ConjunctionQuery) error
FromConjunctionQuery overwrites any union data inside the Query as the provided ConjunctionQuery
func (*Query) FromDateRangeStringQuery ¶
func (t *Query) FromDateRangeStringQuery(v DateRangeStringQuery) error
FromDateRangeStringQuery overwrites any union data inside the Query as the provided DateRangeStringQuery
func (*Query) FromDisjunctionQuery ¶
func (t *Query) FromDisjunctionQuery(v DisjunctionQuery) error
FromDisjunctionQuery overwrites any union data inside the Query as the provided DisjunctionQuery
func (*Query) FromDocIdQuery ¶
func (t *Query) FromDocIdQuery(v DocIdQuery) error
FromDocIdQuery overwrites any union data inside the Query as the provided DocIdQuery
func (*Query) FromFuzzyQuery ¶
func (t *Query) FromFuzzyQuery(v FuzzyQuery) error
FromFuzzyQuery overwrites any union data inside the Query as the provided FuzzyQuery
func (*Query) FromGeoBoundingBoxQuery ¶
func (t *Query) FromGeoBoundingBoxQuery(v GeoBoundingBoxQuery) error
FromGeoBoundingBoxQuery overwrites any union data inside the Query as the provided GeoBoundingBoxQuery
func (*Query) FromGeoBoundingPolygonQuery ¶
func (t *Query) FromGeoBoundingPolygonQuery(v GeoBoundingPolygonQuery) error
FromGeoBoundingPolygonQuery overwrites any union data inside the Query as the provided GeoBoundingPolygonQuery
func (*Query) FromGeoDistanceQuery ¶
func (t *Query) FromGeoDistanceQuery(v GeoDistanceQuery) error
FromGeoDistanceQuery overwrites any union data inside the Query as the provided GeoDistanceQuery
func (*Query) FromGeoShapeQuery ¶
func (t *Query) FromGeoShapeQuery(v GeoShapeQuery) error
FromGeoShapeQuery overwrites any union data inside the Query as the provided GeoShapeQuery
func (*Query) FromIPRangeQuery ¶
func (t *Query) FromIPRangeQuery(v IPRangeQuery) error
FromIPRangeQuery overwrites any union data inside the Query as the provided IPRangeQuery
func (*Query) FromMatchAllQuery ¶
func (t *Query) FromMatchAllQuery(v MatchAllQuery) error
FromMatchAllQuery overwrites any union data inside the Query as the provided MatchAllQuery
func (*Query) FromMatchNoneQuery ¶
func (t *Query) FromMatchNoneQuery(v MatchNoneQuery) error
FromMatchNoneQuery overwrites any union data inside the Query as the provided MatchNoneQuery
func (*Query) FromMatchPhraseQuery ¶
func (t *Query) FromMatchPhraseQuery(v MatchPhraseQuery) error
FromMatchPhraseQuery overwrites any union data inside the Query as the provided MatchPhraseQuery
func (*Query) FromMatchQuery ¶
func (t *Query) FromMatchQuery(v MatchQuery) error
FromMatchQuery overwrites any union data inside the Query as the provided MatchQuery
func (*Query) FromMultiPhraseQuery ¶
func (t *Query) FromMultiPhraseQuery(v MultiPhraseQuery) error
FromMultiPhraseQuery overwrites any union data inside the Query as the provided MultiPhraseQuery
func (*Query) FromNumericRangeQuery ¶
func (t *Query) FromNumericRangeQuery(v NumericRangeQuery) error
FromNumericRangeQuery overwrites any union data inside the Query as the provided NumericRangeQuery
func (*Query) FromPhraseQuery ¶
func (t *Query) FromPhraseQuery(v PhraseQuery) error
FromPhraseQuery overwrites any union data inside the Query as the provided PhraseQuery
func (*Query) FromPrefixQuery ¶
func (t *Query) FromPrefixQuery(v PrefixQuery) error
FromPrefixQuery overwrites any union data inside the Query as the provided PrefixQuery
func (*Query) FromQueryStringQuery ¶
func (t *Query) FromQueryStringQuery(v QueryStringQuery) error
FromQueryStringQuery overwrites any union data inside the Query as the provided QueryStringQuery
func (*Query) FromRegexpQuery ¶
func (t *Query) FromRegexpQuery(v RegexpQuery) error
FromRegexpQuery overwrites any union data inside the Query as the provided RegexpQuery
func (*Query) FromTermQuery ¶
FromTermQuery overwrites any union data inside the Query as the provided TermQuery
func (*Query) FromTermRangeQuery ¶
func (t *Query) FromTermRangeQuery(v TermRangeQuery) error
FromTermRangeQuery overwrites any union data inside the Query as the provided TermRangeQuery
func (*Query) FromWildcardQuery ¶
func (t *Query) FromWildcardQuery(v WildcardQuery) error
FromWildcardQuery overwrites any union data inside the Query as the provided WildcardQuery
func (Query) MarshalJSON ¶
func (*Query) MergeBoolFieldQuery ¶
func (t *Query) MergeBoolFieldQuery(v BoolFieldQuery) error
MergeBoolFieldQuery performs a merge with any union data inside the Query, using the provided BoolFieldQuery
func (*Query) MergeBooleanQuery ¶
func (t *Query) MergeBooleanQuery(v BooleanQuery) error
MergeBooleanQuery performs a merge with any union data inside the Query, using the provided BooleanQuery
func (*Query) MergeConjunctionQuery ¶
func (t *Query) MergeConjunctionQuery(v ConjunctionQuery) error
MergeConjunctionQuery performs a merge with any union data inside the Query, using the provided ConjunctionQuery
func (*Query) MergeDateRangeStringQuery ¶
func (t *Query) MergeDateRangeStringQuery(v DateRangeStringQuery) error
MergeDateRangeStringQuery performs a merge with any union data inside the Query, using the provided DateRangeStringQuery
func (*Query) MergeDisjunctionQuery ¶
func (t *Query) MergeDisjunctionQuery(v DisjunctionQuery) error
MergeDisjunctionQuery performs a merge with any union data inside the Query, using the provided DisjunctionQuery
func (*Query) MergeDocIdQuery ¶
func (t *Query) MergeDocIdQuery(v DocIdQuery) error
MergeDocIdQuery performs a merge with any union data inside the Query, using the provided DocIdQuery
func (*Query) MergeFuzzyQuery ¶
func (t *Query) MergeFuzzyQuery(v FuzzyQuery) error
MergeFuzzyQuery performs a merge with any union data inside the Query, using the provided FuzzyQuery
func (*Query) MergeGeoBoundingBoxQuery ¶
func (t *Query) MergeGeoBoundingBoxQuery(v GeoBoundingBoxQuery) error
MergeGeoBoundingBoxQuery performs a merge with any union data inside the Query, using the provided GeoBoundingBoxQuery
func (*Query) MergeGeoBoundingPolygonQuery ¶
func (t *Query) MergeGeoBoundingPolygonQuery(v GeoBoundingPolygonQuery) error
MergeGeoBoundingPolygonQuery performs a merge with any union data inside the Query, using the provided GeoBoundingPolygonQuery
func (*Query) MergeGeoDistanceQuery ¶
func (t *Query) MergeGeoDistanceQuery(v GeoDistanceQuery) error
MergeGeoDistanceQuery performs a merge with any union data inside the Query, using the provided GeoDistanceQuery
func (*Query) MergeGeoShapeQuery ¶
func (t *Query) MergeGeoShapeQuery(v GeoShapeQuery) error
MergeGeoShapeQuery performs a merge with any union data inside the Query, using the provided GeoShapeQuery
func (*Query) MergeIPRangeQuery ¶
func (t *Query) MergeIPRangeQuery(v IPRangeQuery) error
MergeIPRangeQuery performs a merge with any union data inside the Query, using the provided IPRangeQuery
func (*Query) MergeMatchAllQuery ¶
func (t *Query) MergeMatchAllQuery(v MatchAllQuery) error
MergeMatchAllQuery performs a merge with any union data inside the Query, using the provided MatchAllQuery
func (*Query) MergeMatchNoneQuery ¶
func (t *Query) MergeMatchNoneQuery(v MatchNoneQuery) error
MergeMatchNoneQuery performs a merge with any union data inside the Query, using the provided MatchNoneQuery
func (*Query) MergeMatchPhraseQuery ¶
func (t *Query) MergeMatchPhraseQuery(v MatchPhraseQuery) error
MergeMatchPhraseQuery performs a merge with any union data inside the Query, using the provided MatchPhraseQuery
func (*Query) MergeMatchQuery ¶
func (t *Query) MergeMatchQuery(v MatchQuery) error
MergeMatchQuery performs a merge with any union data inside the Query, using the provided MatchQuery
func (*Query) MergeMultiPhraseQuery ¶
func (t *Query) MergeMultiPhraseQuery(v MultiPhraseQuery) error
MergeMultiPhraseQuery performs a merge with any union data inside the Query, using the provided MultiPhraseQuery
func (*Query) MergeNumericRangeQuery ¶
func (t *Query) MergeNumericRangeQuery(v NumericRangeQuery) error
MergeNumericRangeQuery performs a merge with any union data inside the Query, using the provided NumericRangeQuery
func (*Query) MergePhraseQuery ¶
func (t *Query) MergePhraseQuery(v PhraseQuery) error
MergePhraseQuery performs a merge with any union data inside the Query, using the provided PhraseQuery
func (*Query) MergePrefixQuery ¶
func (t *Query) MergePrefixQuery(v PrefixQuery) error
MergePrefixQuery performs a merge with any union data inside the Query, using the provided PrefixQuery
func (*Query) MergeQueryStringQuery ¶
func (t *Query) MergeQueryStringQuery(v QueryStringQuery) error
MergeQueryStringQuery performs a merge with any union data inside the Query, using the provided QueryStringQuery
func (*Query) MergeRegexpQuery ¶
func (t *Query) MergeRegexpQuery(v RegexpQuery) error
MergeRegexpQuery performs a merge with any union data inside the Query, using the provided RegexpQuery
func (*Query) MergeTermQuery ¶
MergeTermQuery performs a merge with any union data inside the Query, using the provided TermQuery
func (*Query) MergeTermRangeQuery ¶
func (t *Query) MergeTermRangeQuery(v TermRangeQuery) error
MergeTermRangeQuery performs a merge with any union data inside the Query, using the provided TermRangeQuery
func (*Query) MergeWildcardQuery ¶
func (t *Query) MergeWildcardQuery(v WildcardQuery) error
MergeWildcardQuery performs a merge with any union data inside the Query, using the provided WildcardQuery
func (*Query) UnmarshalJSON ¶
type QueryStringQuery ¶
type QueryStringQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Query string `json:"query"`
}
QueryStringQuery defines model for QueryStringQuery.
func (QueryStringQuery) ToQuery ¶
func (v QueryStringQuery) ToQuery() Query
ToQuery creates a Query from a QueryStringQuery. Panics on error.
type RegexpQuery ¶
type RegexpQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
Regexp string `json:"regexp"`
}
RegexpQuery defines model for RegexpQuery.
func (RegexpQuery) ToQuery ¶
func (v RegexpQuery) ToQuery() Query
ToQuery creates a Query from a RegexpQuery. Panics on error.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type TermQuery ¶
type TermQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
Term string `json:"term"`
}
TermQuery defines model for TermQuery.
type TermRangeQuery ¶
type TermRangeQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
InclusiveMax bool `json:"inclusive_max,omitzero"`
InclusiveMin bool `json:"inclusive_min,omitzero"`
Max string `json:"max,omitzero"`
Min string `json:"min,omitzero"`
}
TermRangeQuery defines model for TermRangeQuery.
func (TermRangeQuery) ToQuery ¶
func (v TermRangeQuery) ToQuery() Query
ToQuery creates a Query from a TermRangeQuery. Panics on error.
type WildcardQuery ¶
type WildcardQuery struct {
// Boost A floating-point number used to decrease or increase the relevance scores of a query.
Boost Boost `json:"boost,omitzero"`
Field string `json:"field,omitempty,omitzero"`
Wildcard string `json:"wildcard"`
}
WildcardQuery defines model for WildcardQuery.
func (WildcardQuery) ToQuery ¶
func (v WildcardQuery) ToQuery() Query
ToQuery creates a Query from a WildcardQuery. Panics on error.