Standard retriever
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Generally available
Stack
Generally available
A standard retriever returns top documents from a traditional query.
query-
(Optional, query object)
Defines a query to retrieve a set of top documents.
filter-
(Optional, query object or list of query objects)
Applies a boolean query filter to this retriever, where all documents must match this query but do not contribute to the score.
search_after-
(Optional, search after object)
Defines a search after object parameter used for pagination.
terminate_after-
(Optional, integer) Maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.
ImportantUse with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.
sort- (Optional, sort object) A sort object that specifies the order of matching documents.
min_score-
(Optional,
float)Minimum
_scorefor matching documents. Documents with a lower_scoreare not included in the top documents. collapse-
(Optional, collapse object)
Collapses the top documents by a specified key into a single top document per key.
When a retriever tree contains a compound retriever (a retriever with two or more child retrievers) the search after parameter is not supported.
GET /restaurants/_search{ "retriever": { "standard": { "query": { "bool": { "should": [ { "match": { "region": "Austria" } } ], "filter": [ { "term": { "year": "2019" } } ] } } } } }
- Opens the
retrieverobject. - The
standardretriever is used for defining traditional Elasticsearch queries. - The entry point for defining the search query.
- The
boolobject allows for combining multiple query clauses logically. - The
shouldarray indicates conditions under which a document will match. Documents matching these conditions will have increased relevancy scores. - The
matchobject finds documents where theregionfield contains the word "Austria." - The
filterarray provides filtering conditions that must be met but do not contribute to the relevancy score. - The
termobject is used for exact matches, in this case, filtering documents by theyearfield. - The exact value to match in the
yearfield.