You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Used for <<semantic-reranking,semantic reranking>>.
37
37
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.
38
40
39
41
[discrete]
40
42
[[retrievers-overview-why-are-they-useful]]
@@ -149,6 +151,85 @@ GET example-index/_search
149
151
//NOTCONSOLE
150
152
==============
151
153
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
+
152
233
For more examples on how to use retrievers, please refer to <<retrievers-examples,retriever examples>>.
0 commit comments