query

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 21 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolQuery

func BoolQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func BoostingQuery

func BoostingQuery(query map[string]interface{}) (riot.Query, error)

func CombinedFieldsQuery

func CombinedFieldsQuery(query map[string]interface{}) (riot.Query, error)

func ConstantScoreQuery

func ConstantScoreQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

ConstantScoreQuery wraps a filter query and gives every matching document the same score (`boost`, default 1.0), like Elasticsearch's constant_score.

func DisMaxQuery

func DisMaxQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

DisMaxQuery returns documents matching at least one of the given queries.

riot has no disjunction-max searcher, so this is approximated with a boolean should query with minimum_should_match=1. Matching documents are therefore scored with the SUM of the matching clause scores instead of the maximum one; `tie_breaker` is accepted for API compatibility but is not applied to scoring. The matched document set is identical to Elasticsearch's dis_max, only the relative ordering of multi-clause matches can differ.

func ExistsQuery

func ExistsQuery(query map[string]interface{}) (riot.Query, error)

func FunctionScoreQuery

func FunctionScoreQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

FunctionScoreQuery modifies score of wrapped query with one or more scoring functions: weight, field_value_factor, random_score and decay functions (gauss, exp, linear). `script_score` is not supported.

func FuzzyQuery

func FuzzyQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func GeoBoundingBoxQuery

func GeoBoundingBoxQuery(query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

GeoBoundingBoxQuery parses:

{"location": {"top_left": {"lat": 40.73, "lon": -74.1}, "bottom_right": {"lat": 40.01, "lon": -71.12}}}
{"location": {"top": 40.73, "left": -74.1, "bottom": 40.01, "right": -71.12}}

func GeoDistanceQuery

func GeoDistanceQuery(query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

GeoDistanceQuery parses:

{"distance": "12km", "location": {"lat": 40, "lon": -70}}

func GeoPolygonQuery

func GeoPolygonQuery(query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

GeoPolygonQuery parses:

{"location": {"points": [{"lat": 40, "lon": -70}, [-80, 30], "20,-90"]}}

func GeoShapeQuery

func GeoShapeQuery(query map[string]interface{}) (riot.Query, error)

func HasChildQuery

func HasChildQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

HasChildQuery matches child documents of join relation `type`.

Parents are resolved by uquery.Rewrite before query is parsed: it replaces whole clause by list of `_join_parent` ids. Parsing clause directly (no rewrite pass) returns matching child documents themselves. `min_children` / `max_children` are only honoured by rewrite pass.

func HasParentQuery

func HasParentQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

HasParentQuery matches parent documents of join relation `parent_type`.

Children are resolved by uquery.Rewrite before query is parsed: it replaces whole clause by terms query on `_join_parent`. Parsing clause directly (no rewrite pass) returns matching parent documents themselves.

func IdsQuery

func IdsQuery(query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

func KnnQuery

func KnnQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

KnnQuery parses a k-nearest-neighbours query over a vector field. As in Elasticsearch, k is the number of neighbours per shard; use size to cap the merged hits. The metric is the mapping similarity (space_type), cosine by default. The search is HNSW approximate when the vector mapping declares index_options (or OpenSearch method), or when num_candidates (or OpenSearch method_parameters.ef_search) is set as the search beam; otherwise it is exact. Graphs are built per segment on first use and persisted next to it, so later searches and restarts reuse them. filter restricts the candidates before ranking and a numeric similarity drops matches below it. Elasticsearch form:

{"field": "embedding", "query_vector": [0.1, 0.2], "k": 5, "num_candidates": 50, "filter": {...}, "similarity": 0.8, "boost": 2}

OpenSearch form:

{"embedding": {"vector": [0.1, 0.2], "k": 5, "filter": {...}, "method_parameters": {"ef_search": 50}}}

func MatchAllQuery

func MatchAllQuery() (riot.Query, error)

func MatchBoolPrefixQuery

func MatchBoolPrefixQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func MatchNoneQuery

func MatchNoneQuery() (riot.Query, error)

func MatchPhrasePrefixQuery

func MatchPhrasePrefixQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func MatchPhraseQuery

func MatchPhraseQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func MatchQuery

func MatchQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func MultiMatchQuery

func MultiMatchQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func NestedQuery

func NestedQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

NestedQuery matches hidden documents of nested property, ie documents tagged with `_nested_path` equal to `path`.

Root documents are resolved by uquery.Rewrite before query is parsed: it replaces whole clause by list of `_nested_parent` ids. Parsing clause directly (no rewrite pass) therefore returns hidden nested documents themselves, which is what nested aggregations and sub searches need.

func ParentIDQuery

func ParentIDQuery(query map[string]interface{}) (riot.Query, error)

ParentIDQuery matches child documents of relation `type` that point to given parent `id`. It needs no rewrite pass, hidden join fields hold everything query requires.

func ParseFuzziness

func ParseFuzziness(fuzziness interface{}, query string, zer *analysis.Analyzer) int

func PrefixQuery

func PrefixQuery(query map[string]interface{}) (riot.Query, error)

func Query

func Query(query interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func QueryStringQuery

func QueryStringQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func RangeQuery

func RangeQuery(query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

func RangeQueryNumeric

func RangeQueryNumeric(field string, query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

func RangeQueryTime

func RangeQueryTime(field string, query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

func RegexpQuery

func RegexpQuery(query map[string]interface{}) (riot.Query, error)

func SimpleQueryStringQuery

func SimpleQueryStringQuery(query map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.Query, error)

func TermQuery

func TermQuery(query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

func TermQueryBool

func TermQueryBool(field string, value *meta.TermQuery) (riot.Query, error)

func TermQueryNumeric

func TermQueryNumeric(field string, value *meta.TermQuery) (riot.Query, error)

func TermQueryText

func TermQueryText(field string, value *meta.TermQuery) (riot.Query, error)

func TermsQuery

func TermsQuery(query map[string]interface{}, mappings *meta.Mappings) (riot.Query, error)

func TermsSetQuery

func TermsSetQuery(query map[string]interface{}) (riot.Query, error)

func WildcardQuery

func WildcardQuery(query map[string]interface{}) (riot.Query, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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