Pinned 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
9.1+
Generally available since 9.1
A pinned retriever returns top documents by always placing specific documents at the top of the results, with the remaining hits provided by a secondary retriever.
This retriever offers similar functionality to the pinned query, but works seamlessly with other retrievers. This is useful for promoting certain documents for particular queries, regardless of their relevance score.
ids-
(Optional, array of strings)
A list of document IDs to pin at the top of the results, in the order provided.
docs-
(Optional, array of objects)
A list of objects specifying documents to pin. Each object must contain at least an
_idfield, and may also specify_indexif pinning documents across multiple indices. retriever-
(Optional, retriever object)
A retriever (for example a
standardretriever or a specialized retriever such asrrfretriever) used to retrieve the remaining documents after the pinned ones.
Either ids or docs must be specified.
GET /restaurants/_search{ "retriever": { "pinned": { "docs": [ { "_id": "doc1", "_index": "my-index" }, { "_id": "doc2" } ], "retriever": { "standard": { "query": { "match": { "title": "elasticsearch" } } } } } } }