|
|
@@ -43,6 +43,9 @@ A <<text-similarity-reranker-retriever, retriever>> that enhances search results
|
|
|
`rule`::
|
|
|
A <<rule-retriever, retriever>> that applies contextual <<query-rules>> to pin or exclude documents for specific queries.
|
|
|
|
|
|
+`pinned`::
|
|
|
+A <<pinned-retriever, retriever>> that always places specified documents at the top of the results, with the remaining hits provided by a secondary retriever.
|
|
|
+
|
|
|
[[standard-retriever]]
|
|
|
==== Standard Retriever
|
|
|
|
|
|
@@ -946,6 +949,60 @@ GET movies/_search
|
|
|
<1> The `rule` retriever is the outermost retriever, applying rules to the search results that were previously reranked using the `rrf` retriever.
|
|
|
<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.
|
|
|
|
|
|
+[[pinned-retriever]]
|
|
|
+==== Pinned retriever
|
|
|
+
|
|
|
+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 <<query-dsl-pinned-query,pinned query>>, but works seamlessly with other retrievers. This is useful for promoting certain documents for particular queries, regardless of their relevance score.
|
|
|
+
|
|
|
+[discrete]
|
|
|
+[[retrievers-overview-pinned-retriever-parameters]]
|
|
|
+===== Parameters
|
|
|
+
|
|
|
+`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)
|
|
|
++
|
|
|
+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.
|
|
|
+
|
|
|
+`retriever`::
|
|
|
+(Optional, retriever object)
|
|
|
++
|
|
|
+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.
|
|
|
+
|
|
|
+Either `ids` or `docs` must be specified.
|
|
|
+
|
|
|
+[discrete]
|
|
|
+[[pinned-retriever-example]]
|
|
|
+==== Example: Pinned retriever using `docs
|
|
|
+
|
|
|
+[source,console]
|
|
|
+----
|
|
|
+GET /restaurants/_search
|
|
|
+{
|
|
|
+ "retriever": {
|
|
|
+ "pinned": {
|
|
|
+ "docs": [
|
|
|
+ { "_id": "doc1", "_index": "my-index" },
|
|
|
+ { "_id": "doc2" }
|
|
|
+ ],
|
|
|
+ "retriever": {
|
|
|
+ "standard": {
|
|
|
+ "query": {
|
|
|
+ "match": {
|
|
|
+ "title": "elasticsearch"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+----
|
|
|
+
|
|
|
[discrete]
|
|
|
[[multi-field-query-format]]
|
|
|
=== Multi-field query format
|