query
54 blocks in 10 groups. Open a block for its pins, an example and how it behaves.
query
- function score
queryv14.0.4Wraps a query with function_score for custom relevance scoring. Builds script_score, random_score and decay functions from pins. The script_score scores documents by matching theirtagsfield against the provided params — documents without a tags field return a neutral score of 1. - simple query string
queryv10.4.28Ignores any invalid parts of the query string. Should always be used when working with user input. - query string
queryv10.4.28Can be used to create a complex search that includes wildcards or searches across multiple fields. If user input is used the simple query string should be used instead of the normal query string. - must not
queryv10.4.28All queries providedmust notmatch. - aggregation
queryv13.0.4Build an aggregation on the given query. - multiple
queryv10.4.28 - must
queryv10.4.28All queries providedmustmatch. - array should / or
queryv10.4.28One or all queries from array providedshouldmatch array based. - should / or
queryv10.4.28One or all queries providedshouldmatch. - switch
queryv12.0.4Returns a query based of the given expression. - filter
queryv10.4.28Build a custom query using higher-level bool query.
query: exists
- field
queryv10.4.28checks if the given field exists in a document. Attention: Checking on a field which has > 1024 sub-fields can cause a too_many_clauses exception - custom field
queryv10.4.28checks if the given custom field exists in a document.
query: geo
- polygon
queryv10.4.28 - bounding box
queryv13.0.8Matches geo_point values that intersect a bounding box - distance
queryv13.0.8checks if the given fields is within the given distance.
query: misc.
- sorting
queryv10.4.28Sorts the results on the given field and ordering. - elseif
queryv10.4.28 - disable cache
queryv10.4.28Disables the storage cache in full for this query. Cache could be behind max. 5 seconds. - geo distance sorting
queryv12.0.4Sorts the results on the given geo_point field and ordering. - include removed
queryv10.4.28Include removed documents in the matching results. - include total hits
queryv10.4.28Include the total number of documents found besides the matching document count. - profile
queryv9.2.15Returns a profile of the matching results for debug purpose only. - offset
queryv10.4.28Start document search with an offset of.. - fields to select
queryv12.1.1Only return the selected fields in the search results (e.g. speed improvement) - count only
queryv10.4.28Return only the total number of documents found. - cast to object
objectv10.4.28 - sort score
queryv14.0.4Sorts results by their relevance score. Use together with a tiebreaker sort (e.g. sorting on _meta.created) for reliable cursor-based pagination with search_after. - if
queryv10.4.28 - search after
queryv14.0.4Enables cursor-based pagination using search_after. Pass the cursor from a previous search to continue from where it left off. - limit
queryv10.4.28Limit the search result, this does not work for streaming search on large storages. - include geo distance
queryv12.0.4Adds a field "distance" which returns the distance in meters based on the given geo_point - sort random
queryv10.4.28Sort the results randomly. This sorting only works if at least one positive query (e.g. must, filter, should) is used.
query: prefix
- value
queryv10.4.28checks if the given field starts with the given value. - search as you type
queryv15.0.0Matches documents whose field starts with the given phrase, analyzed on both sides. Use this for type-ahead: the last word is treated as a prefix and the input goes through the same analyzer as the stored text, sodemo testmatchesDEMO-Test-1. For an exact, unanalyzed prefix on a keyword field usestarts withinstead.
query: range
- field >= {value}
queryv10.4.28 - field <= {value}
queryv10.4.28 - field > {value}
queryv10.4.28 - field < {value}
queryv10.4.28 - number
queryv11.3.3 - date format
queryv10.4.28 - date
queryv11.3.3do range checks on date fields.
query: term
- array match include
queryv10.4.28Field array must include given value. - fields
queryv10.4.28 - match with any
queryv12.0.5Returns documents that contain one or more exact terms in a provided field. - fuzzy
queryv12.0.5Returns documents that contain terms similar to the search term
query: wildcard
range date
- field <= {value}
queryv10.4.28 - field > {value}
queryv10.4.28 - field < {value}
queryv10.4.28 - field between
queryv10.4.28 - field >= {value}
queryv10.4.28
references
- use query
queryv13.0.1Use the query which was previously defined by a define reference - define query
flowv13.0.1Store this query as reference, which can later be used by "use reference"