Skip to content

Commit a93c6bf

Browse files
committed
made the suggested changes
1 parent a536750 commit a93c6bf

File tree

1 file changed

+49
-73
lines changed

1 file changed

+49
-73
lines changed

docs/reference/elasticsearch/rest-apis/retrievers.md

Lines changed: 49 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -41,79 +41,12 @@ The following retrievers are available:
4141
`text_similarity_reranker`
4242
: A [retriever](#text-similarity-reranker-retriever) that enhances search results by re-ranking documents based on semantic similarity to a specified inference text, using a machine learning model.
4343

44+
`pinned`
45+
: A [retriever](#pinned-retriever) that always places specified documents at the top of the results, with the remaining hits provided by a secondary retriever.
46+
4447
`rule`
4548
: A [retriever](#rule-retriever) that applies contextual [Searching with query rules](/reference/elasticsearch/rest-apis/searching-with-query-rules.md#query-rules) to pin or exclude documents for specific queries.
4649

47-
## Pinned Retriever [pinned-retriever]
48-
49-
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.
50-
51-
#### Parameters [pinned-retriever-parameters]
52-
53-
`ids`
54-
: (Optional, array of strings)
55-
56-
A list of document IDs to pin at the top of the results, in the order provided.
57-
58-
`documents`
59-
: (Optional, array of objects)
60-
61-
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.
62-
63-
`fallback`
64-
: (Optional, retriever object)
65-
66-
A retriever to use for retrieving the remaining documents after the pinned ones.
67-
68-
Either `ids` or `documents` must be specified.
69-
70-
### Example using `ids` [pinned-retriever-example-ids]
71-
72-
```console
73-
GET /restaurants/_search
74-
{
75-
"retriever": {
76-
"pinned": {
77-
"ids": ["doc1", "doc2"],
78-
"fallback": {
79-
"standard": {
80-
"query": {
81-
"match": {
82-
"title": "elasticsearch"
83-
}
84-
}
85-
}
86-
}
87-
}
88-
}
89-
}
90-
```
91-
92-
### Example using `documents` [pinned-retriever-example-documents]
93-
94-
```console
95-
GET /restaurants/_search
96-
{
97-
"retriever": {
98-
"pinned": {
99-
"documents": [
100-
{ "_id": "doc1", "_index": "my-index" },
101-
{ "_id": "doc2" }
102-
],
103-
"fallback": {
104-
"standard": {
105-
"query": {
106-
"match": {
107-
"title": "elasticsearch"
108-
}
109-
}
110-
}
111-
}
112-
}
113-
}
114-
}
115-
```
116-
11750
## Standard Retriever [standard-retriever]
11851

11952
A standard retriever returns top documents from a traditional [query](/reference/query-languages/querydsl.md).
@@ -991,7 +924,53 @@ GET movies/_search
991924
1. The `rule` retriever is the outermost retriever, applying rules to the search results that were previously reranked using the `rrf` retriever.
992925
2. The `rrf` retriever returns results from all of its sub-retrievers, and the output of the `rrf` retriever is used as input to the `rule` retriever.
993926

927+
## Pinned Retriever [pinned-retriever]
928+
929+
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](/reference/query-languages/query-dsl/query-dsl-pinned-query.md), but works seamlessly with other retrievers. This is useful for promoting certain documents for particular queries, regardless of their relevance score.
930+
931+
#### Parameters [pinned-retriever-parameters]
932+
933+
`ids`
934+
: (Optional, array of strings)
935+
936+
A list of document IDs to pin at the top of the results, in the order provided.
937+
938+
`documents`
939+
: (Optional, array of objects)
940+
941+
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.
942+
943+
`retriever`
944+
: (Optional, retriever object)
994945

946+
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.
947+
948+
Either `ids` or `documents` must be specified.
949+
950+
### Example using `documents` [pinned-retriever-example-documents]
951+
952+
```console
953+
GET /restaurants/_search
954+
{
955+
"retriever": {
956+
"pinned": {
957+
"documents": [
958+
{ "_id": "doc1", "_index": "my-index" },
959+
{ "_id": "doc2" }
960+
],
961+
"retriever": {
962+
"standard": {
963+
"query": {
964+
"match": {
965+
"title": "elasticsearch"
966+
}
967+
}
968+
}
969+
}
970+
}
971+
}
972+
}
973+
```
995974
996975
## Common usage guidelines [retriever-common-parameters]
997976
@@ -1016,6 +995,3 @@ When a retriever is specified as part of a search, the following elements are no
1016995
* [`terminate_after`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#request-body-search-terminate-after)
1017996
* [`sort`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#search-sort-param)
1018997
* [`rescore`](/reference/elasticsearch/rest-apis/filter-search-results.md#rescore) use a [rescorer retriever](#rescorer-retriever) instead
1019-
1020-
1021-

0 commit comments

Comments
 (0)