Skip to content

Commit 77def07

Browse files
authored
Include Pinned Retriever in 8.19 Documentation (#129217)
* Document pinned retriever in 8.19 retrievers overview * updated the changes in the doc * made changes * Added pinned to retrievers overview doc * Pinned example added to the asciidoc * Modified & fixed issues * Fixed PR docs * Ascii files modified * Fixing formatting issues * Just fixed the formatting overall
1 parent 43280fa commit 77def07

File tree

2 files changed

+55
-3
lines changed

2 files changed

+55
-3
lines changed

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,6 @@ GET /retrievers_example/_search
14781478
[discrete]
14791479
[[retrievers-examples-chaining-text-similarity-reranker-retrievers]]
14801480
==== Example: Chaining multiple semantic rerankers
1481-
14821481
Full composability means we can chain together multiple retrievers of the same type. For instance,
14831482
imagine we have a computationally expensive reranker that's specialized for AI content. We can rerank the results of a `text_similarity_reranker` using another `text_similarity_reranker` retriever. Each reranker can operate on different fields and/or use different inference services.
14841483

@@ -1523,3 +1522,33 @@ Note that our example applies two reranking steps. First, we rerank the top 100
15231522
documents from the `knn` search using the `my-rerank-model` reranker. Then we
15241523
pick the top 10 results and rerank them using the more fine-grained
15251524
`my-other-more-expensive-rerank-model`.
1525+
1526+
[discrete]
1527+
[[retrievers-examples-pinned-retriever]]
1528+
==== Example: Using the pinned retriever
1529+
1530+
Pinned Retriever example using `docs`
1531+
1532+
[source,console]
1533+
----
1534+
GET /retrievers_example/_search
1535+
{
1536+
"retriever": {
1537+
"pinned": {
1538+
"docs": [
1539+
{ "_id": "1" },
1540+
{ "_id": "2" }
1541+
],
1542+
"retriever": {
1543+
"standard": {
1544+
"query": {
1545+
"match": {
1546+
"text": "elasticsearch"
1547+
}
1548+
}
1549+
}
1550+
}
1551+
}
1552+
}
1553+
}
1554+
----

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Returns top documents from a <<search-api-knn,knn search>>, in the context of a
2727
Combines the top results from multiple sub-retrievers using a weighted sum of their scores. Allows to specify different
2828
weights for each retriever, as well as independently normalize the scores from each result set.
2929

30-
[discrete]
31-
[[retrievers-overview-linear-retriever-parameters]]
30+
[discrete]
31+
[[retrievers-overview-linear-retriever-parameters]]
3232
==== Linear Retriever Parameters
3333

3434
`retrievers`
@@ -69,6 +69,29 @@ Applies <<query-rules,query rules>> to the query before returning results.
6969
* <<text-similarity-reranker-retriever,*Text Similarity Re-ranker Retriever*>>.
7070
Used for <<semantic-reranking,semantic reranking>>.
7171
Requires first creating a `rerank` task using the <<put-inference-api,{es} Inference API>>.
72+
* <<retrievers-overview-pinned-retriever-parameters,*Pinned Retriever*>>.
73+
Returns top documents by always placing specific documents at the top of the results, with the remaining hits provided by a secondary retriever.
74+
75+
[discrete]
76+
[[retrievers-overview-pinned-retriever-parameters]]
77+
==== Pinned Retriever Parameters
78+
79+
`ids`::
80+
(Optional, array of strings)
81+
+
82+
A list of document IDs to pin at the top of the results, in the order provided.
83+
84+
`docs`::
85+
(Optional, array of objects)
86+
+
87+
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.
88+
89+
`retriever`::
90+
(Optional, retriever object)
91+
+
92+
A retriever (for example a `standard` retriever or a specialized retriever such as `rrf` retriever) used to retrieve the remaining documents after the pinned ones.
93+
94+
Either `ids` or `docs` must be specified.
7295

7396
[discrete]
7497
[[retrievers-overview-why-are-they-useful]]

0 commit comments

Comments
 (0)