Skip to content

Commit 4a0b97f

Browse files
committed
Document pinned retriever in 8.19 retrievers overview
1 parent 2474a1f commit 4a0b97f

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

docs/reference/search/search-your-data/retrievers-overview.asciidoc

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Applies <<query-rules,query rules>> to the query before returning results.
3535
* <<text-similarity-reranker-retriever,*Text Similarity Re-ranker Retriever*>>.
3636
Used for <<semantic-reranking,semantic reranking>>.
3737
Requires first creating a `rerank` task using the <<put-inference-api,{es} Inference API>>.
38+
* <<pinned-retriever,*Pinned Retriever*>>.
39+
Returns top documents by always placing specific documents at the top of the results, in the order provided. Useful for promoting certain documents for particular queries, regardless of their relevance score. The remaining results are filled by a fallback retriever.
3840

3941
[discrete]
4042
[[retrievers-overview-why-are-they-useful]]
@@ -149,6 +151,85 @@ GET example-index/_search
149151
//NOTCONSOLE
150152
==============
151153

154+
[[pinned-retriever]]
155+
=== Pinned Retriever
156+
157+
A `pinned` retriever returns top documents by always placing specific documents at the top of the results, in the order provided. This is useful for promoting certain documents for particular queries, regardless of their relevance score. The remaining results are filled by a fallback retriever.
158+
159+
[discrete]
160+
[[pinned-retriever-parameters]]
161+
==== Parameters
162+
163+
`ids`::
164+
(Optional, array of strings)
165+
+
166+
A list of document IDs to pin at the top of the results, in the order provided.
167+
168+
`documents`::
169+
(Optional, array of objects)
170+
+
171+
A list of objects specifying documents to pin. Each object must contain at least an `_id` field, and may also specify `_index` if pinning documents across multiple indices.
172+
173+
`fallback`::
174+
(Optional, retriever object)
175+
+
176+
A retriever to use for retrieving the remaining documents after the pinned ones.
177+
178+
Either `ids` or `documents` must be specified.
179+
180+
[discrete]
181+
[[pinned-retriever-example-ids]]
182+
==== Example using `ids`
183+
184+
[source,console]
185+
----
186+
GET /restaurants/_search
187+
{
188+
"retriever": {
189+
"pinned": {
190+
"ids": ["doc1", "doc2"],
191+
"fallback": {
192+
"standard": {
193+
"query": {
194+
"match": {
195+
"title": "elasticsearch"
196+
}
197+
}
198+
}
199+
}
200+
}
201+
}
202+
}
203+
----
204+
205+
[discrete]
206+
[[pinned-retriever-example-documents]]
207+
==== Example using `documents`
208+
209+
[source,console]
210+
----
211+
GET /restaurants/_search
212+
{
213+
"retriever": {
214+
"pinned": {
215+
"documents": [
216+
{ "_id": "doc1", "_index": "my-index" },
217+
{ "_id": "doc2" }
218+
],
219+
"fallback": {
220+
"standard": {
221+
"query": {
222+
"match": {
223+
"title": "elasticsearch"
224+
}
225+
}
226+
}
227+
}
228+
}
229+
}
230+
}
231+
----
232+
152233
For more examples on how to use retrievers, please refer to <<retrievers-examples,retriever examples>>.
153234

154235
[discrete]

0 commit comments

Comments
 (0)