Skip to content

Commit c134e7d

Browse files
authored
[8.x] Fix for rrf documentation test using a knn retriever (#120549)
1 parent 2b2ae57 commit c134e7d

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

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

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,25 @@ Learn how to combine different retrievers in these hands-on examples.
99
==== Add example data
1010

1111
To begin with, lets create the `retrievers_example` index, and add some documents to it.
12+
We will set `number_of_shards=1` for our examples to ensure consistent and reproducible ordering.
1213

1314
[source,console]
1415
----
1516
PUT retrievers_example
1617
{
18+
"settings": {
19+
"number_of_shards": 1
20+
},
1721
"mappings": {
1822
"properties": {
1923
"vector": {
2024
"type": "dense_vector",
2125
"dims": 3,
2226
"similarity": "l2_norm",
23-
"index": true
27+
"index": true,
28+
"index_options": {
29+
"type": "flat"
30+
}
2431
},
2532
"text": {
2633
"type": "text"
@@ -459,6 +466,9 @@ and index a couple of documents.
459466
----
460467
PUT retrievers_example_nested
461468
{
469+
"settings": {
470+
"number_of_shards": 1
471+
},
462472
"mappings": {
463473
"properties": {
464474
"nested_field": {
@@ -471,7 +481,10 @@ PUT retrievers_example_nested
471481
"type": "dense_vector",
472482
"dims": 3,
473483
"similarity": "l2_norm",
474-
"index": true
484+
"index": true,
485+
"index_options": {
486+
"type": "flat"
487+
}
475488
}
476489
}
477490
},
@@ -640,7 +653,7 @@ This would propagate the `inner_hits` defined for the `knn` query to the `rrf` r
640653
"value": 3,
641654
"relation": "eq"
642655
},
643-
"max_score": 0.44353113,
656+
"max_score": 0.44444445,
644657
"hits": [
645658
{
646659
"_index": "retrievers_example_nested",
@@ -649,7 +662,7 @@ This would propagate the `inner_hits` defined for the `knn` query to the `rrf` r
649662
"field": "nested_field",
650663
"offset": 2
651664
},
652-
"_score": 0.44353113,
665+
"_score": 0.44444445,
653666
"fields": {
654667
"nested_field": [
655668
{
@@ -667,7 +680,7 @@ This would propagate the `inner_hits` defined for the `knn` query to the `rrf` r
667680
"field": "nested_field",
668681
"offset": 1
669682
},
670-
"_score": 0.26567122,
683+
"_score": 0.21301977,
671684
"fields": {
672685
"nested_field": [
673686
{
@@ -685,7 +698,7 @@ This would propagate the `inner_hits` defined for the `knn` query to the `rrf` r
685698
"field": "nested_field",
686699
"offset": 0
687700
},
688-
"_score": 0.18478848,
701+
"_score": 0.16889325,
689702
"fields": {
690703
"nested_field": [
691704
{
@@ -717,7 +730,7 @@ This would propagate the `inner_hits` defined for the `knn` query to the `rrf` r
717730
"value": 1,
718731
"relation": "eq"
719732
},
720-
"max_score": 0.32002488,
733+
"max_score": 0.31715825,
721734
"hits": [
722735
{
723736
"_index": "retrievers_example_nested",
@@ -726,7 +739,7 @@ This would propagate the `inner_hits` defined for the `knn` query to the `rrf` r
726739
"field": "nested_field",
727740
"offset": 0
728741
},
729-
"_score": 0.32002488,
742+
"_score": 0.31715825,
730743
"fields": {
731744
"nested_field": [
732745
{

0 commit comments

Comments
 (0)