Skip to content

Commit 0a3c661

Browse files
pmpailisgeorgewallace
authored andcommitted
Removing tech-preview header and updating documentation for retrievers and RRF (elastic#114810)
1 parent 58e0b48 commit 0a3c661

File tree

4 files changed

+49
-88
lines changed

4 files changed

+49
-88
lines changed

docs/reference/search/retriever.asciidoc

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[[retriever]]
22
=== Retriever
33

4-
preview::["This functionality is in technical preview and may be changed or removed in a future release. The syntax will likely change before GA. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features."]
5-
64
A retriever is a specification to describe top documents returned from a
75
search. A retriever replaces other elements of the <<search-search, search API>>
86
that also return top documents such as <<query-dsl, `query`>> and
@@ -75,7 +73,7 @@ Collapses the top documents by a specified key into a single top document per ke
7573
===== Restrictions
7674

7775
When a retriever tree contains a compound retriever (a retriever with two or more child
78-
retrievers) *only* the query element is allowed.
76+
retrievers) the <<search-after, search after>> parameter is not supported.
7977

8078
[discrete]
8179
[[standard-retriever-example]]
@@ -245,12 +243,6 @@ include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=rrf-rank-window-size]
245243

246244
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=rrf-filter]
247245

248-
===== Restrictions
249-
250-
An RRF retriever is a compound retriever. Child retrievers may not use
251-
elements that are restricted by having a compound retriever as part of
252-
the retriever tree.
253-
254246
[discrete]
255247
[[rrf-retriever-example-hybrid]]
256248
==== Example: Hybrid search
@@ -413,10 +405,6 @@ Applies the specified <<query-dsl-bool-query, boolean query filter>> to the chil
413405
If the child retriever already specifies any filters, then this top-level filter is applied in conjuction
414406
with the filter defined in the child retriever.
415407

416-
===== Restrictions
417-
418-
A text similarity re-ranker retriever is a compound retriever. Child retrievers may not use elements that are restricted by having a compound retriever as part of the retriever tree.
419-
420408
[discrete]
421409
[[text-similarity-reranker-retriever-example-cohere]]
422410
==== Example: Cohere Rerank
@@ -555,4 +543,3 @@ at the top-level and instead are only allowed as elements of specific retrievers
555543
* <<request-body-search-terminate-after, `terminate_after`>>
556544
* <<search-sort-param, `sort`>>
557545
* <<rescore, `rescore`>>
558-
* <<search-api-min-score, `min_score`>>

docs/reference/search/rrf.asciidoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[[rrf]]
22
=== Reciprocal rank fusion
33

4-
preview::["This functionality is in technical preview and may be changed or removed in a future release. The syntax will likely change before GA. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features."]
5-
64
https://plg.uwaterloo.ca/~gvcormac/cormacksigir09-rrf.pdf[Reciprocal rank fusion (RRF)]
75
is a method for combining multiple result sets with different relevance indicators into a single result set.
86
RRF requires no tuning, and the different relevance indicators do not have to be related to each other to achieve high-quality results.
@@ -95,19 +93,21 @@ The `rrf` retriever supports:
9593

9694
* <<search-aggregations, aggregations>>
9795
* <<search-from-param, from>>
96+
* <<search-suggesters, suggesters>>
97+
* <<highlighting, highlighting>>
98+
* <<collapse-search-results, collapse>>
99+
* <<profiling-queries, profiling>>
98100

99101
The `rrf` retriever does not currently support:
100102

101103
* <<search-api-scroll-query-param, scroll>>
102-
* <<search-api-pit, point in time>>
103104
* <<search-sort-param, sort>>
104105
* <<rescore, rescore>>
105-
* <<search-suggesters, suggesters>>
106-
* <<highlighting, highlighting>>
107-
* <<collapse-search-results, collapse>>
108-
* <<profiling-queries, profiling>>
109106

110107
Using unsupported features as part of a search with an `rrf` retriever results in an exception.
108+
+
109+
IMPORTANT: It is best to avoid providing a <<search-api-pit, point in time>> as part of the request, as
110+
RRF creates one internally that is shared by all sub-retrievers to ensure consistent results.
111111

112112
[[rrf-using-multiple-standard-retrievers]]
113113
==== Reciprocal rank fusion using multiple standard retrievers

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

Lines changed: 38 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[[retrievers-overview]]
22
=== Retrievers
33

4-
preview::[]
5-
6-
A retriever is an abstraction that was added to the Search API in *8.14.0*.
4+
A retriever is an abstraction that was added to the Search API in *8.14.0* and was made generally available in *8.16.0*.
75
This abstraction enables the configuration of multi-stage retrieval pipelines within a single `_search` call.
86
This simplifies your search application logic, because you no longer need to configure complex searches via multiple {es} calls or implement additional client-side logic to combine results from different queries.
97

@@ -32,8 +30,7 @@ with different relevance indicators into a single result set.
3230
An RRF retriever is a *compound retriever*, where its `filter` element is
3331
propagated to its sub retrievers.
3432
+
35-
Sub retrievers may not use elements that are restricted by having a compound retriever as part of the retriever tree.
36-
See the <<rrf-using-multiple-standard-retrievers,RRF documentation>> for detailed examples and information on how to use the RRF retriever.
33+
3734
* <<text-similarity-reranker-retriever,*Text Similarity Re-ranker Retriever*>>. Used for <<semantic-reranking,semantic reranking>>.
3835
Requires first creating a `rerank` task using the <<put-inference-api,{es} Inference API>>.
3936

@@ -72,82 +69,56 @@ When using compound retrievers, only the query element is allowed, which enforce
7269
[[retrievers-overview-example]]
7370
==== Example
7471

75-
The following example demonstrates how using retrievers simplify the composability of queries for RRF ranking.
72+
The following example demonstrates the powerful queries that we can now compose, and how retrievers simplify this process. We can use any combination of retrievers we want, propagating the
73+
results of a nested retriever to its parent. In this scenario, we'll make use of all 4 (currently) available retrievers, i.e. `standard`, `knn`, `text_similarity_reranker` and `rrf`.
74+
We'll first combine the results of a `semantic` query using the `standard` retriever, and that of a `knn` search on a dense vector field, using `rrf` to get the top 100 results.
75+
Finally, we'll then rerank the top-50 results of `rrf` using the `text_similarity_reranker`
7676

7777
[source,js]
7878
----
7979
GET example-index/_search
8080
{
8181
"retriever": {
82-
"rrf": {
83-
"retrievers": [
84-
{
85-
"standard": {
86-
"query": {
87-
"sparse_vector": {
88-
"field": "vector.tokens",
89-
"inference_id": "my-elser-endpoint",
90-
"query": "What blue shoes are on sale?"
82+
"text_similarity_reranker": {
83+
"retriever": {
84+
"rrf": {
85+
"retrievers": [
86+
{
87+
"standard": {
88+
"query": {
89+
"semantic": {
90+
"field": "inference_field",
91+
"query": "state of the art vector database"
92+
}
93+
}
94+
}
95+
},
96+
{
97+
"knn": {
98+
"query_vector": [
99+
0.54,
100+
...,
101+
0.245
102+
],
103+
"field": "embedding",
104+
"k": 10,
105+
"num_candidates": 15
91106
}
92107
}
93-
}
94-
},
95-
{
96-
"standard": {
97-
"query": {
98-
"match": {
99-
"text": "blue shoes sale"
100-
}
101-
}
102-
}
103-
}
104-
]
105-
}
106-
}
107-
}
108-
----
109-
//NOTCONSOLE
110-
111-
This example demonstrates how you can combine different retrieval strategies into a single `retriever` pipeline.
112-
113-
Compare to `RRF` with `sub_searches` approach:
114-
115-
.*Expand* for example
116-
[%collapsible]
117-
==============
118-
119-
[source,js]
120-
----
121-
GET example-index/_search
122-
{
123-
"sub_searches":[
124-
{
125-
"query":{
126-
"match":{
127-
"text":"blue shoes sale"
128-
}
129-
}
130-
},
131-
{
132-
"query":{
133-
"sparse_vector": {
134-
"field": "vector.tokens",
135-
"inference_id": "my-elser-endoint",
136-
"query": "What blue shoes are on sale?"
137-
}
108+
],
109+
"rank_window_size": 100,
110+
"rank_constant": 10
138111
}
139-
}
140-
],
141-
"rank":{
142-
"rrf":{
143-
"rank_window_size":50,
144-
"rank_constant":20
112+
},
113+
"rank_window_size": 50,
114+
"field": "description",
115+
"inference_text": "what's the best way to create complex pipelines and retrieve documents?",
116+
"inference_id": "my-awesome-rerank-model"
145117
}
146118
}
147119
}
148120
----
149121
//NOTCONSOLE
150-
==============
151122

152123
[discrete]
153124
[[retrievers-overview-glossary]]

server/src/main/java/org/elasticsearch/search/retriever/CompoundRetrieverBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ public ActionRequestValidationException validate(
194194
validationException
195195
);
196196
}
197+
for (RetrieverSource innerRetriever : innerRetrievers) {
198+
validationException = innerRetriever.retriever().validate(source, validationException, allowPartialSearchResults);
199+
}
197200
return validationException;
198201
}
199202

0 commit comments

Comments
 (0)