@@ -1548,128 +1548,6 @@ setup:
15481548 - match : { hits.total.value: 0 }
15491549 - length : { hits.hits: 0 }
15501550
1551- ---
1552- " Linear retriever with top-level L2 normalization " :
1553- - requires :
1554- cluster_features : [ "linear_retriever.l2_norm" ]
1555- reason : " Support for L2 normalization"
1556-
1557- - do :
1558- search :
1559- index : test
1560- body :
1561- retriever :
1562- linear :
1563- normalizer : l2_norm
1564- retrievers : [
1565- {
1566- retriever : {
1567- standard : {
1568- query : {
1569- constant_score : {
1570- filter : {
1571- term : {
1572- keyword : {
1573- value : " one"
1574- }
1575- }
1576- },
1577- boost : 5.0
1578- }
1579- }
1580- }
1581- },
1582- weight : 1.0
1583- },
1584- {
1585- retriever : {
1586- standard : {
1587- query : {
1588- constant_score : {
1589- filter : {
1590- term : {
1591- keyword : {
1592- value : " four"
1593- }
1594- }
1595- },
1596- boost : 12.0
1597- }
1598- }
1599- }
1600- },
1601- weight : 1.0
1602- }
1603- ]
1604-
1605- - match : { hits.total.value: 2 }
1606- - match : { hits.hits.0._id: "1" } # Both have same final score, ranked by document order
1607- - match : { hits.hits.1._id: "4" }
1608- # With per-retriever L2 normalization: each retriever normalizes its own scores
1609- # First retriever: [5.0] → L2 normalized to [1.0] → final: 1.0 * 1.0 = 1.0
1610- # Second retriever: [12.0] → L2 normalized to [1.0] → final: 1.0 * 1.0 = 1.0
1611- - close_to : { hits.hits.0._score: { value: 1.0, error: 0.01} }
1612- - close_to : { hits.hits.1._score: { value: 1.0, error: 0.01} }
1613-
1614- ---
1615- " Linear retriever with top-level minmax normalization " :
1616- - do :
1617- search :
1618- index : test
1619- body :
1620- retriever :
1621- linear :
1622- normalizer : minmax
1623- retrievers : [
1624- {
1625- retriever : {
1626- standard : {
1627- query : {
1628- constant_score : {
1629- filter : {
1630- term : {
1631- keyword : {
1632- value : " one"
1633- }
1634- }
1635- },
1636- boost : 3.0
1637- }
1638- }
1639- }
1640- },
1641- weight : 2.0
1642- },
1643- {
1644- retriever : {
1645- standard : {
1646- query : {
1647- constant_score : {
1648- filter : {
1649- term : {
1650- keyword : {
1651- value : " four"
1652- }
1653- }
1654- },
1655- boost : 9.0
1656- }
1657- }
1658- }
1659- },
1660- weight : 1.5
1661- }
1662- ]
1663-
1664- - match : { hits.total.value: 2 }
1665- - match : { hits.hits.0._id: "1" }
1666- - match : { hits.hits.1._id: "4" }
1667- # With per-retriever minmax normalization: each retriever normalizes its own scores
1668- # First retriever: [3.0] → normalized to [1.0] → final: 1.0 * 2.0 = 2.0
1669- # Second retriever: [9.0] → normalized to [1.0] → final: 1.0 * 1.5 = 1.5
1670- - close_to : { hits.hits.0._score: { value: 2.0, error: 0.001} }
1671- - close_to : { hits.hits.1._score: { value: 1.5, error: 0.001} }
1672-
16731551---
16741552" Linear retriever with per-retriever normalizer override " :
16751553 - requires :
@@ -1682,7 +1560,7 @@ setup:
16821560 body :
16831561 retriever :
16841562 linear :
1685- normalizer : minmax # Top-level normalizer
1563+ normalizer : minmax
16861564 retrievers : [
16871565 {
16881566 retriever : {
@@ -1702,7 +1580,7 @@ setup:
17021580 }
17031581 },
17041582 weight : 1.0,
1705- normalizer : l2_norm # Override with L2 norm
1583+ normalizer : l2_norm
17061584 },
17071585 {
17081586 retriever : {
@@ -1721,14 +1599,11 @@ setup:
17211599 }
17221600 }
17231601 },
1724- weight : 1.0 # Uses top-level minmax normalizer
1602+ weight : 1.0
17251603 }
17261604 ]
17271605
17281606 - match : { hits.total.value: 2 }
1729- # First retriever uses L2 norm (score normalized to 1.0)
1730- # Second retriever uses minmax (score normalized to 1.0 since it's the only score)
1731- # Both docs get final score of 1.0, ranking by document order
17321607 - match : { hits.hits.0._id: "1" }
17331608 - match : { hits.hits.1._id: "4" }
17341609 - close_to : { hits.hits.0._score: { value: 1.0, error: 0.001} }
@@ -1869,8 +1744,8 @@ setup:
18691744 ]
18701745
18711746 - match : { hits.total.value: 2 }
1872- - match : { hits.hits.0._id: "1" } # 7.5 * 2.0 = 15.0
1873- - match : { hits.hits.1._id: "4" } # 3.2 * 1.0 = 3.2
1747+ - match : { hits.hits.0._id: "1" }
1748+ - match : { hits.hits.1._id: "4" }
18741749 - close_to : { hits.hits.0._score: { value: 15.0, error: 0.001} }
18751750 - close_to : { hits.hits.1._score: { value: 3.2, error: 0.001} }
18761751
@@ -1951,9 +1826,6 @@ setup:
19511826
19521827 - match : { hits.total.value: 1 }
19531828 - match : { hits.hits.0._id: "1" }
1954- # All three retrievers return same doc with different normalizations:
1955- # none: 10.0, l2_norm: 1.0, minmax: 1.0 (single value)
1956- # Final score: 10.0 + 1.0 + 1.0 = 12.0
19571829 - close_to : { hits.hits.0._score: { value: 12.0, error: 0.001} }
19581830
19591831---
@@ -2006,8 +1878,6 @@ setup:
20061878
20071879 - match : { hits.total.value: 1 }
20081880 - match : { hits.hits.0._id: "1" }
2009- # Only second retriever returns results, minmax normalization on [10.0] = 1.0
2010- # Final score: 2.0 * 1.0 = 2.0
20111881 - close_to : { hits.hits.0._score: { value: 2.0, error: 0.001} }
20121882
20131883---
@@ -2027,8 +1897,6 @@ setup:
20271897 normalizer : l2_norm
20281898
20291899 - match : { hits.total.value: 2 }
2030- # Both doc1 and doc4 have "other" in other_keyword field
2031- # L2 normalization should be applied to generated retrievers
20321900
20331901---
20341902" Linear retriever error handling - invalid normalizer " :
@@ -2110,8 +1978,5 @@ setup:
21101978 - match : { hits.total.value: 2 }
21111979 - match : { hits.hits.0._id: "1" }
21121980 - match : { hits.hits.1._id: "4" }
2113- # With per-retriever L2 normalization: each retriever normalizes its own scores
2114- # First retriever: [1000.0] → L2 normalized to [1.0] → final: 1.0 * 1.0 = 1.0
2115- # Second retriever: [1.0] → L2 normalized to [1.0] → final: 1.0 * 1.0 = 1.0
21161981 - close_to : { hits.hits.0._score: { value: 1.0, error: 0.001} }
21171982 - close_to : { hits.hits.1._score: { value: 1.0, error: 0.001} }
0 commit comments