knnBeta
定义
knnBeta
knnBeta
操作符使用分层可导航小世界算法来执行语义搜索。您可以使用 Atlas Search 对 kNN 查询的支持来搜索与所选产品相似的产品、搜索图片等。
语法
knnBeta
通过以下语法实现:
1 { 2 $search: { 3 "index": "<index name>", // optional, defaults to "default" 4 "knnBeta": { 5 "vector": [<array-of-numbers>], 6 "path": "<field-to-search>", 7 "filter": {<filter-specification>}, 8 "k": <number>, 9 "score": {<options>} 10 } 11 } 12 }
选项
行为
只能对索引为 Atlas Search 类型 knnVector 的字段运行 kNN 查询。
您可以在 阶段之后使用$limit
$search
来限制knnBeta
查询结果中的文档数量。我们建议将 的值设置为高于k
$limit
的值。这种过度请求模式是在近似最近邻搜索中平衡延迟和召回的主要方法。根据经验,我们发现5 -10 的乘数对于许多使用案例效果良好,但我们建议根据特定数据集进行调整。
例子
以下查询查找与该查询最近的 150
个邻居,并将剩余结果数限制为 50
。
1 db.<collection>.aggregate({ 2 "$search": { 3 "knnBeta": { 4 "vector": <array-of-numbers-to-search>, 5 "path": <indexed-field-to-search>, 6 "k": 150 7 } 8 } 9 }, 10 { 11 "$limit": 50 12 })
性能
要提高查询性能,请使用$project
阶段选择要在结果中返回的字段,除非您需要结果中的所有字段。我们建议在$project
阶段排除向量字段。
评分
您可以在score
searchScore
阶段将$project
字段与 $meta 表达式 结合使用,以返回结果中文档的分数。
Atlas Search 仅在从 0
到 1
的固定范围内对 kNN 查询结果进行评分。对于 cosine
和 dotProduct
的相似度,Atlas Search 使用以下算法对分数进行归一化:
score = (1 + cosine/dot_product(v1,v2)) / 2
限制
knnBeta
操作符必须是查询中的顶级操作符,因此,不能在以下情况使用 knnBeta
操作符:
embeddedDocument 操作符
compound 运算符
分面收集器
不能使用 knnBeta
操作符查询使用 vectorSearch 类型索引的字段。不能将 $search
排序选项与 knnBeta
操作符结合使用。
举例
以下查询使用 knnBeta
操作符搜索样本 sample_mflix.embedded_movies
集合。查询搜索 plot_embedding
字段,其中包含使用 OpenAI 的 text-embedding-ada-002
嵌入模型创建的嵌入。如果已将样本集合添加到 Atlas 集群,并为该集合创建了样本索引定义,则可以切换到 sample_mflix
数据库并对该集合运行以下查询。
以下查询使用knnBeta
操作符在plot_embedding
字段中搜索vector
维度,并请求结果中的最多5
个最近邻。该查询还指定了$project
阶段以:
在结果中排除
_id
字段并且包含plot
和title
字段。在结果中添加名为
score
的字段。
1 db.embedded_movies.aggregate([ 2 { 3 "$search": { 4 "index": "default", 5 "knnBeta": { 6 "vector": [0.024552748,-0.015502235,-0.013485263,0.012069505,-0.0027216184,0.023427898,-0.011920818,-0.03865862,0.0058472776,-0.026013758,-0.009069907,0.010834756,0.0065680863,-0.03470225,0.025936183,0.011164454,0.029918408,-0.0045866705,0.0134723345,-0.020376582,-0.014519608,0.02301416,0.007589501,0.0038464677,0.0022254563,-0.0034812149,0.022677999,-0.009651725,0.011772131,0.0113842515,-0.004790307,-0.029633963,0.008022632,-0.016407287,-0.025535375,-0.02173416,-0.004622226,-0.01448082,0.0061737425,-0.009334957,0.004237579,0.009367281,-0.021475572,0.006141419,0.00014464658,0.0046254583,-0.019743046,-0.002291719,-0.0166788,0.020066278,0.0202085,-0.0015983852,-0.02229012,-0.0017195974,-0.020842036,0.0098391995,0.0041244477,0.0018327287,0.01335597,-0.012780616,-0.010162433,-0.0008165663,-0.013989506,-0.012955162,-0.018708702,-0.0038303062,-0.00789334,0.0051587922,0.0036331343,-0.0010270715,0.03190952,0.0055628326,0.012825869,0.00020707087,0.015256578,-0.02133335,-0.023958,-0.0058763684,0.012625465,0.020389512,0.018346682,-0.031831946,-0.008701421,0.032918006,0.012890516,0.0026521233,-0.015489305,0.03452124,-0.018631127,-0.00096404116,0.020156784,0.0146489,0.011106271,0.009897382,0.018450117,-0.011836777,-0.0072921272,0.036305483,-0.0044606095,-0.013265465,-0.019924056,0.017234761,-0.011694555,-0.0025454566,-0.030487297,-0.019678399,0.020893754,0.0038400032,0.037857,0.007938593,-0.03299558,-0.010744251,0.017170114,-0.045692157,-0.0065939445,-0.0070400056,0.005911924,0.019019006,-0.002708689,0.00074545515,0.029194366,0.0036492958,0.0063321264,-0.018488904,-0.0012064656,0.0022997998,-0.004011316,-0.011345464,-0.012612536,-0.027616993,-0.0066327327,-0.008565663,0.025729313,-0.0094771795,-0.025406081,0.03043558,-0.032581843,0.004004852,-0.021449715,0.0038561646,0.0073761675,0.019626683,-0.019316379,-0.009612937,0.013924859,0.018282035,0.006597177,0.0005672732,0.0037591949,-0.015450518,0.023854565,-0.03247841,0.014778194,-0.008358794,0.028677195,0.0019975773,-0.015295366,0.018049307,-0.040313568,-0.0056177825,0.007589501,0.021307493,0.0014505063,-0.013924859,0.0138343545,0.016213346,0.0040921243,-0.005029499,-0.010698998,0.00036343464,-0.002519598,0.032064673,-0.023583049,0.013252536,-0.0026198002,0.017493347,-0.01854062,0.037546698,-0.0129034445,-0.008875967,0.0037979828,0.0008064653,0.0027701033,0.013278395,-0.035865888,-0.011856171,-0.028185882,-0.0021963655,-0.0003739397,0.0054593985,-0.00042828318,-0.004583438,-0.0025955576,0.0019620217,-0.6855634,-0.011164454,0.017415771,-0.024940627,3.7828315E-05,0.016717589,0.021682441,0.009244452,-0.020880826,-0.004583438,0.0027652548,0.016989104,0.0015595972,0.0037850535,-0.022820221,-0.01354991,0.014131729,-0.033874776,0.014933346,-0.014571325,-0.015747892,0.031107904,0.0043733367,-0.014222234,-0.010162433,0.031599216,0.0147652645,0.0011773747,-0.013233142,0.027125679,-0.030694166,0.029582245,0.0031563663,0.015670316,0.04729539,0.00993617,-0.027616993,0.01912244,0.0068977834,0.030306287,-0.03576245,0.00077818247,0.014623042,0.0048387917,0.0025050526,-0.0053947517,0.006538995,-0.0013511122,0.0112291,0.018863853,0.0073826322,0.0127224345,0.006519601,-0.00945132,0.029168509,-0.0059959646,0.024591535,0.01168809,0.008895361,0.0028105073,-0.012334555,0.017118398,-0.0181786,0.008766068,-0.01243799,0.027487699,-0.002164042,0.022522846,0.016277993,-0.023117594,0.025574163,0.039434377,-0.0036492958,0.0011393948,0.009031119,-0.00557253,0.020622239,0.02022143,-0.0058860653,-0.0062674796,0.0033745482,-0.022923656,-0.03361619,-0.02707396,0.033693764,-0.026401637,0.0051135393,0.014442032,0.0028169719,-0.0015208093,-0.0069624297,0.0118820295,-0.0042505083,-0.0057987925,0.012884051,-0.0047547515,-0.008332936,0.02337618,0.018139813,-0.04251155,0.013181425,-0.007835158,0.015385871,-0.012075969,-0.015075568,0.0007878794,-0.028289316,-0.0026602042,0.026660224,-0.022755574,0.0067426316,-0.012088899,0.009457786,-0.009781018,-0.013705062,-0.022548705,0.031857803,0.0050618225,0.024604464,-0.017157186,0.01373092,0.017170114,0.0025955576,-0.0024371736,0.0155151645,0.0020783856,-0.014739406,-0.009625866,-0.027332548,0.008559199,-0.004793539,0.025069918,0.005265459,-0.009955564,-0.008972936,-0.010698998,0.017596781,-0.0067103086,0.036434777,-0.018101025,-0.022419412,0.015980618,0.010155967,-0.016989104,-0.005582227,-0.018463045,-0.013588698,-0.014390315,-0.0363572,-0.008404047,-0.008895361,-0.017338196,-0.008216572,-0.015799608,0.0019911127,0.007537784,0.01214708,-0.0014690921,-0.015036779,-0.005666267,0.031237196,0.0028816184,-0.005970106,-0.004719196,-0.022975372,-0.011675161,-0.0056501054,0.023789918,0.0046577817,-0.020984259,-0.016963245,-0.023970928,-0.020570522,0.023608908,0.0036880837,0.008436371,-0.010492129,0.006144651,-0.021449715,-0.009141018,-0.004803236,-0.004670711,0.003384245,0.009250917,0.004670711,-0.012237586,0.015553952,-2.7247497E-05,-0.0038917202,0.010000817,0.0020299007,0.038270738,0.02209618,-0.0042892965,0.00478061,-0.00046868724,0.020648098,0.003145053,0.004185862,0.013459405,0.015696174,-0.025936183,0.02691881,-0.018656984,0.011157989,-0.023906281,0.01104809,-0.022820221,0.017402843,0.001338991,0.006144651,-0.033874776,-0.008177784,-0.010246473,-0.007822229,0.009574149,0.015541023,0.013142637,-0.008410512,-0.002311113,-0.016963245,-0.021216987,-0.0019959612,0.0073373797,0.0025276789,-0.00039616192,-0.0053010145,-0.008061421,0.019096581,-0.016303852,-0.011694555,-0.016833954,-0.004929297,0.035478007,0.003006063,-0.03656407,-0.0011636373,-0.02377699,0.033848915,9.106068E-05,0.007537784,0.02430709,0.018980218,-0.027823862,-0.008035562,-0.018514762,0.017364055,0.010653746,-0.009761624,-0.00788041,-0.030280428,-0.0054529337,0.00024969716,0.023453757,0.005566065,-0.010485665,0.017402843,-0.003959599,0.025354363,0.0401067,0.00788041,-0.0025777798,0.00575354,0.0040501044,-0.0045252563,-0.004027478,0.0023692949,0.0010456574,-0.0066521266,-0.016277993,-0.012399202,-0.004176165,0.007705865,-0.009690513,0.018954359,0.0075119254,-0.016536579,0.0010828292,0.013873142,0.01948446,0.001221011,-0.020880826,0.024785474,0.0011434352,-0.023453757,-0.006070308,-0.020286078,-0.0018812136,-0.012050111,0.012528495,0.019187085,-0.0058957622,0.0031660632,0.011151524,0.0118820295,0.008423441,0.0181786,-0.011267887,0.0204283,0.009826271,-0.00807435,0.002707073,-0.013116778,-0.011539403,0.0068137427,0.00047393978,-0.016652944,-0.008753139,-0.0056371763,-0.010556776,-0.008520411,-0.008197178,-0.0041826298,-0.0046060644,-0.014907487,0.004929297,0.003471518,0.011073948,0.02560002,0.0053042467,-0.0048290947,-0.030125277,-0.014015364,0.0047547515,0.1075718,-0.0020767692,0.0059959646,0.012192333,0.0024129313,-0.010666675,-0.025238,-0.0052460646,0.009069907,0.014610113,0.025755173,-0.010349907,0.013265465,0.01446789,-0.004800004,0.015437588,-0.013233142,-0.015256578,-0.00881132,-0.0075830366,2.77778E-05,0.00014272738,0.029530529,-0.0007846471,-0.013485263,-0.025509516,-0.0047385897,0.019949915,-0.00992324,-0.0026602042,-0.007550713,-0.021591937,-0.004929297,0.015657386,0.0021365674,0.00742142,0.0122246565,0.008604451,0.031392347,-0.02581982,0.039667103,0.025522444,0.013808496,-0.01985941,0.024242444,0.007970915,0.00046949534,0.027720427,0.022548705,-0.013149101,0.06568086,0.009108694,0.01987234,-0.00303677,0.023350323,0.0066391975,0.0036525282,0.01819153,-0.005536974,0.0055434387,-0.008429905,-0.027875578,0.0030028308,-0.0058763684,0.015204861,-0.03247841,-0.02244527,0.011558797,-0.013860214,-0.009166876,-0.017325267,-0.045174986,-0.0156056695,-0.026233556,0.011274353,0.015243649,0.009619402,-0.020699814,-0.017027892,0.01594183,-5.6111156E-05,-0.022303049,0.014610113,0.0024872748,-0.0035684877,0.015049709,0.02004042,0.017351124,-0.013627485,0.013394758,0.009709907,0.023104666,0.007001218,-0.023996787,0.008358794,0.012179404,0.012534959,0.007001218,-0.020156784,0.013394758,0.023272745,-0.036072757,-0.017428702,-0.019962844,0.017907085,-0.021798806,-0.00945132,0.0068266722,-0.018669914,-0.021837594,0.006138187,-0.002755558,0.01929052,0.0030238407,-0.004425054,0.012172939,0.010492129,0.018113954,0.00732445,-0.017674359,0.0034650534,-0.012968091,0.018450117,0.015734963,-0.024151938,0.0027636385,0.009554755,-0.019911127,-0.0053301053,-0.008656168,-0.013065061,0.012644859,-0.0025341434,-0.007408491,-0.031444065,-0.0034585886,-0.0020622239,0.010776575,-0.008320007,-0.010194756,-0.005675964,0.0061640455,-0.015075568,-0.030694166,-0.004880812,-0.02040244,-0.0032694975,-0.020273147,-0.009250917,0.032918006,0.00010626271,0.0017066681,0.005407681,0.024229515,-0.007111117,-0.027513558,-0.02968568,-0.0033357602,0.013026273,0.002191517,0.030306287,-0.00073575816,0.0025777798,-0.010220614,-0.005045661,0.005666267,-0.0061769746,-0.018760419,-0.034236796,0.016277993,0.0037139424,0.02209618,-0.0026892952,-0.022820221,0.005019802,0.016368497,-0.00044080845,-0.021229915,-0.0018989914,-0.024436383,-0.005905459,-0.007970915,-0.008649704,0.025483657,0.011410111,-0.0075119254,0.028030729,5.5909135E-05,0.0010682837,-0.008048492,0.03436609,-0.004977782,-0.00039535385,-0.0017325267,-0.009535361,-0.009322028,0.01085415,-0.01521779,-0.022871938,0.003940205,0.013110314,-0.005349499,0.0065907123,0.0045414176,0.005915156,0.031625077,0.004942226,-0.030539015,0.0034779827,-0.021023048,-0.019885268,-0.031625077,-0.0029591944,-0.0145842545,-0.0016775772,-0.010285261,-0.024345879,0.017557994,-0.027487699,-0.02616891,-0.010336978,-0.007182228,0.020324865,0.028496185,0.0076800063,0.022018604,-0.027901437,-0.0016307083,0.017325267,0.0011620212,-0.0017212135,0.009056977,0.00724041,-0.01466183,0.0024355575,-0.0046286904,0.003115962,-0.034081645,-0.019355167,0.012127686,0.029892549,0.0118820295,-0.020337794,-0.004496165,0.0033486895,0.021811735,-0.020854967,-0.0020864664,-0.012696576,7.9697034E-05,-0.018915571,-0.009263846,0.010976979,0.013136173,-0.0008000006,0.004017781,0.0017292943,-0.019988703,-0.0029301033,0.00011676777,0.00097535434,0.041322052,-0.0104080895,-0.0018456581,0.00012444454,-0.00084525323,-0.007311521,0.013705062,0.0012169707,0.0307976,0.011242029,0.0074537434,-0.012955162,0.025923254,0.013627485,0.01020122,-0.002600406,-0.0032032349,-0.008837179,0.0016105063,0.0146489,0.014377385,-0.022367695,-0.013769708,-0.018579409,-0.0063385908,-0.014312739,-0.015825467,-0.004871115,-0.009884452,-0.008481623,-0.001002829,-0.009360815,0.01984648,0.010356372,0.009153947,0.0011442434,0.029427094,-0.031806085,0.004948691,0.00732445,-0.0044993977,-0.006538995,0.014442032,0.018708702,-0.025522444,0.0018472743,-0.00040686902,-0.019432742,-0.014222234,-0.0020573754,-0.0068913186,-0.0047385897,-0.032788713,-0.0042181853,0.0030626287,-0.004483236,-0.035891745,-0.02190224,0.018437186,0.00022747493,-0.0063418234,0.018889712,0.0002092931,0.0307976,-0.0030416185,0.014273951,0.013963647,-0.0023078807,-0.011080413,-0.006063843,0.012793546,-0.010401624,-0.009858594,0.00047798018,-0.014635972,-0.008798391,0.01559274,0.0028218206,-0.004105054,-0.0045769736,0.032349117,0.00881132,0.016989104,0.010155967,0.016096983,-1.900254E-05,-0.022703856,-0.019497389,-0.014222234,0.004337781,0.03193538,-0.009709907,-0.007873946,-0.028651336,-0.0006113136,-0.02134628,-0.0070981877,-0.008300613,0.020441229,0.026815375,0.011707484,-0.00010232331,0.002957578,-0.0040727304,0.01649779,-0.033280026,-5.7020246E-05,-0.00398869,0.012955162,0.0045478824,0.02338911,-0.039563667,-0.0072080866,0.008164855,0.015140214,-0.018113954,0.009160412,-0.034598816,-0.01912244,-0.032064673,-0.0065842476,-0.0107701095,-0.004483236,0.01290991,-0.009696977,-0.0006303035,-0.0016953549,0.0041018217,-0.009729301,0.001120001,0.013601627,0.011242029,0.02911679,-0.005734146,-0.0068589956,0.007052935,-0.0128129395,0.015502235,0.0036331343,0.009457786,0.01910951,0.013937789,-0.021514362,-0.014700618,-0.0012492939,0.0052525294,-0.02002749,0.0043701045,-0.009179805,0.0023191937,-0.019833552,-0.015864255,-0.015295366,-0.014416173,-0.0034909118,0.014054153,-0.022419412,0.027591133,0.012625465,-0.030099418,0.012366879,0.004205256,-0.006603642,-0.0031353561,-0.02359598,-0.010039604,-0.002807275,0.00603152,-0.007789905,-0.0025842446,0.008714351,0.00714344,-0.00432162,-0.030409722,0.026052546,0.24493273,-0.008882431,-0.009587078,0.014558395,-0.0035846494,0.011267887,0.031599216,0.0009317179,-0.015204861,-0.008423441,-0.031288914,0.010194756,0.0009713139,0.0027523255,-0.010647281,-0.036150333,-0.035555582,-0.0086367745,-0.022057392,-0.024022646,-0.004046872,-0.010336978,0.0026440425,-0.016627084,0.02023436,-0.009787482,-0.0051555596,0.006852531,0.02002749,0.014791123,0.01410587,-0.025483657,-0.005921621,0.0052816207,-0.0057018227,-0.01728648,0.011487686,0.0042602057,0.0034553562,0.019704258,0.010065462,0.01224405,-0.009250917,0.022846079,0.0014933345,0.030306287,-0.016394356,0.010873544,0.00063434395,0.018501833,-0.026841234,-0.014067082,0.027487699,0.029090934,-0.011720413,0.012993949,0.017739004,0.01002021,-0.023156382,-0.007537784,0.0010731322,0.019368097,-0.006151116,0.034004066,-0.025651738,0.021087693,-0.023466686,-0.0057890955,-0.0005288893,-0.0024824264,-0.009406068,-0.0069624297,0.0004985863,0.0005692934,-0.0034553562,-0.015243649,0.031263057,0.0004654549,0.014791123,0.0024468706,-0.023789918,0.013860214,-0.00454465,-0.01446789,-0.0023127291,-0.047941856,0.009929705,-0.008384653,-0.0202085,-0.007919198,0.014118799,-0.0010076776,0.011862636,-0.006529298,0.004670711,0.031418208,-0.016937388,0.021979816,-0.008106673,0.019523248,-0.019975774,-0.025470728,0.0073050563,0.0065648537,-0.024604464,0.013304253,0.008184249,0.005207277,0.014816982,0.00329374,0.0008759603,-0.019936986,-0.0054690954,0.0015313143,-0.0072145513,0.01114506,0.02691881,-0.006762026,-0.014597183,-0.009813341,-0.002092931,0.0004711115,-0.021397997,0.012470313,0.0036557605,-0.02412608,0.0009204048,-0.00016787893,0.013937789,-0.01782951,0.0061737425,-0.032581843,0.007492531,0.007899804,-0.0034165685,0.031211339,0.010168897,-0.02618184,-0.012011323,0.025005274,0.019070722,0.0068396013,0.0028185882,-0.00482263,0.0053721257,-0.019730117,-0.0021187896,0.008151926,-0.015114356,-0.0017325267,-0.029892549,-0.027798003,-0.00817132,0.002411315,0.0363572,-0.018514762,-0.057664692,-0.030358003,-0.0020638402,0.035219423,-0.030461438,0.0045252563,0.006833137,0.00034484876,0.00042343469,0.0054593985,-0.16590883,0.008080815,0.0055402066,-0.015036779,0.028832346,0.008927684,0.010414554,-0.008106673,-0.018346682,-0.00052242464,0.015825467,0.008223037,-0.040184274,0.01242506,0.0014294961,0.00853334,-0.01816567,0.02059638,0.026298203,0.008248895,0.0042408113,-0.006613339,0.0066521266,-0.02024729,0.024888908,0.027513558,0.018773349,-0.0114295045,-0.0032274774,-0.00472566,-0.0046092966,0.0012113141,0.009684049,-0.012948697,0.03576245,-0.015502235,-0.017014964,-0.0063127326,0.010227079,0.0066391975,0.013200819,0.0017632338,0.0040016193,-0.0027248508,-0.0026149517,0.027410123,-0.0031353561,-0.003006063,-0.0065616216,-0.0036428312,0.0061866716,-0.014985062,0.007938593,-0.010537382,0.0098391995,0.02893578,0.014312739,0.0121341515,0.003859397,-0.020441229,0.003195154,-0.021966886,0.005288085,0.027487699,-0.0021559612,-0.019238804,0.00048202058,0.016989104,-0.029194366,0.0046933373,-0.031392347,-0.007899804,0.015903043,-0.02393214,0.01095112,-0.022794362,-0.0005907075,0.0046739434,0.0026957598,-0.0066521266,-0.020505875,0.042951144,-0.026285274,0.00087838457,0.013420617,-0.007221016,-0.0032290935,-0.008863037,-0.010130109,0.010634352,0.012651323,-0.026285274,0.027306689,-0.020867895,0.016122842,0.026686082,0.005365661,0.00058545504,0.030487297,-0.010175361,0.0030626287,-0.020842036,-0.017234761,0.0029818206,0.025548303,0.0022270726,0.030280428,-0.002766871,0.02247113,-0.014597183,-0.003581417,0.0067232377,0.010964049,0.0008290916,-0.0070270766,0.005514348,0.014403244,-0.008223037,0.02709982,-0.020661026,0.044011347,0.009496573,-0.028185882,-0.013717991,0.0045187916,0.0074149556,-0.10503766,-0.0014642436,-0.01894143,0.008856573,-0.028496185,-0.0057050553,-0.013808496,-0.0029010125,0.01132607,0.009011724,0.018708702,-0.013026273,0.0071240463,-0.011985464,0.014739406,-0.0017923247,-0.02950467,-0.018656984,0.006852531,0.008003239,-0.004631923,-0.0018876783,-0.012728899,-0.023828706,-0.014829911,-0.0064711166,-0.02896164,0.006613339,0.013705062,0.014610113,0.009677583,-0.025677597,0.010996372,-0.023104666,-0.0007701016,0.014545467,-0.027151536,0.00882425,0.023906281,-0.04158064,0.0056468733,-0.018023448,0.008481623,-0.0017438398,-0.0075119254,0.017208902,-0.011823848,0.0015959609,0.007149905,-0.019730117,-0.026505072,-0.0075183897,-0.01168809,-0.0059862672,0.033228308,-0.007886875,0.018695774,0.005747075,-0.001696971,0.005178186,-0.0019490925,-0.019200016,-0.00993617,0.02466911,0.016277993,-0.01335597,-0.0066715204,0.020635169,0.032555986,-0.0012072737,-0.00945132,0.01984648,-0.0025567696,0.027616993,-0.028444467,0.0161487,-0.019264663,-0.014920416,0.01781658,-0.026466284,0.003044851,-0.031625077,0.023673555,-0.013071526,0.023182241,-0.018993147,0.021048905,-0.005317176,0.0027523255,-0.003610508,0.0049971757,0.0033648512,-0.0056080855,-0.020156784,-0.0066521266,0.011778595,-0.011545868,-0.028987499,0.00464162,-0.0028315175,-0.009141018,-0.0016727286,-0.05849217,0.01801052,0.02023436,-0.006477581,0.00074505113,-0.020066278,0.024087293,0.0017745469,0.007369703,-0.005979803,-0.0033551543,0.028237598,0.019316379,0.007841622,0.009425462,-0.030358003,-0.00487758,-0.0040501044,0.0011967686,-0.0014901023,-0.0047450545,0.005905459,0.012981021,0.020997189,-0.02060931,0.0026117193,-0.022587493,0.011675161,-1.9671734E-05,-0.009632331,0.006367682,-0.032555986,0.012121222,-0.0041535385,0.0018133348,-0.013317183,-0.009884452,0.020803249,0.018023448,0.044787105,-0.02262628,-0.017557994,0.0168986,-0.0020557593,-0.009490109,0.012211727,-0.0077446527,0.0035878818,0.037003666,-0.0059183887,0.026013758,0.011901423,-0.0023143452,-0.023531333,-0.008048492,-0.027953153,0.022393553,-0.01448082,-0.025949111,-0.020725673,0.008714351,0.009044047,0.0063095,0.025380222,0.022432342,-0.011823848,0.012793546,-0.008229502,-0.010181827,-0.020467088,-0.0015313143,-0.0035587908,0.0014012132,0.014752335,-0.008320007,0.015747892,-0.022018604,-0.009865059,-0.0052525294,0.043028723,-0.008863037,0.004800004,-0.04923479,0.015747892,0.009121624,0.023156382,-0.022005673,0.011358393,-0.0095224315,-0.0010602028,0.013330112,0.008307077,0.023350323,1.0486119E-05,0.0051587922,0.019471532,-0.008785462,-0.0012541424,0.022109108,0.0057987925,-0.010970514,-0.001597577,-0.0040436396,-0.030668307,-0.0050650546,0.004066266,-0.023958,-0.030461438,-0.0015983852,0.015903043,-0.0049195997,-0.010259402,-0.006677985,0.010168897,-0.011371322,0.0029107095,-0.0052913176,-0.029194366,-0.008313542,0.01634264,-0.0050230343,0.016433144,0.016019408,-0.0124961715,0.013058596,0.012211727,0.027487699,0.00394667,-0.0078028347,0.0008290916,0.011487686,-0.016730519,-0.028004872,0.008662634,0.0061737425,-0.00676849,-0.0060993987,0.0029737398,-0.031599216,0.04437337,0.019368097,0.0008937381,0.010686069,-0.023052948,0.021850523,0.008669098,0.02932366,-0.0156056695,-0.018230317,-0.0020412137,-0.02968568,0.030487297,0.012890516,-0.021204058,0.022160826,-0.029065074,0.009580614,0.004295761,-0.0051814183,0.023893353,0.0076218243,0.033383463,-0.0010052533,-0.023440827,-0.016096983,-0.01103516,-0.009199199,-0.0023434362,-0.004476771,0.0068202075,0.0057793986,-0.0224582,-0.0057082875,0.026660224,-0.0077640465,-0.0030125277,-0.008585057,0.0134723345,0.010511524,-0.0033195987,0.010033139,-0.014920416,0.010505059,0.0037268717,0.019342238,0.003461821,-0.015851326,-0.033900633], 7 "path": "plot_embedding", 8 "k": 5 9 } 10 } 11 }, 12 { 13 "$project": { 14 "_id": 0, 15 "plot": 1, 16 "title": 1, 17 "score": { $meta: "searchScore" } 18 } 19 } 20 ])
1 [ 2 { 3 plot: 'When two girls move to the country to be near their ailing mother, they have adventures with the wonderous forest spirits who live nearby.', 4 title: 'My Neighbor Totoro', 5 score: 0.9999986886978149 6 }, 7 { 8 plot: "To escape a war, a girl flees to a remote farmhouse and becomes part of an expansive family's unusual, perhaps even supernatural lifestyle.", 9 title: 'Black Moon', 10 score: 0.8282386660575867 11 }, 12 { 13 plot: 'A shape-shifting mountain man and a group of children team up to protect an enchanted forest from evil lumberjacks.', 14 title: 'Forest Warrior', 15 score: 0.8196926712989807 16 }, 17 { 18 plot: 'A shape-shifting mountain man and a group of children team up to protect an enchanted forest from evil lumberjacks.', 19 title: 'Forest Warrior', 20 score: 0.8196901082992554 21 }, 22 { 23 plot: 'An adventurous girl finds another world that is a strangely idealized version of her frustrating home, but it has sinister secrets.', 24 title: 'Coraline', 25 score: 0.815956711769104 26 } 27 ]
以下查询筛选文档以查找在 6 月1971 ( 1971-06-30
) ( ≤
) 30之前或之前上映的电影,然后在筛选后的文档中的plot_embedding
字段中搜索vector
维度,并请求结果中最多5
个最近邻。该查询还指定了$project
阶段以:
结果中排除
_id
字段,仅包含plot
、title
和released
字段。在结果中添加名为
score
的字段。
1 db.embedded_movies.aggregate([ 2 { 3 "$search": { 4 "index": "default", 5 "knnBeta": { 6 "vector": [-0.0072121937,-0.030757688,0.014948666,-0.018497631,-0.019035352,0.028149737,-0.0019593239,-0.02012424,-0.025649332,-0.007985169,0.007830574,0.023726976,-0.011507247,-0.022839734,0.00027999343,-0.010431803,0.03823202,-0.025756875,-0.02074262,-0.0042883316,-0.010841816,0.010552791,0.0015266258,-0.01791958,0.018430416,-0.013980767,0.017247427,-0.010525905,0.0126230195,0.009255537,0.017153326,0.008260751,-0.0036060968,-0.019210111,-0.0133287795,-0.011890373,-0.0030599732,-0.0002904958,-0.001310697,-0.020715732,0.020890493,0.012428096,0.0015837587,-0.006644225,-0.028499257,-0.005098275,-0.0182691,0.005760345,-0.0040665213,0.00075491105,0.007844017,0.00040791242,0.0006780336,0.0027037326,-0.0041370974,-0.022275126,0.004775642,-0.0045235846,-0.003659869,-0.0020567859,0.021602973,0.01010917,-0.011419867,0.0043689897,-0.0017946466,0.000101610516,-0.014061426,-0.002626435,-0.00035540052,0.0062174085,0.020809835,0.0035220778,-0.0071046497,-0.005041142,0.018067453,0.012569248,-0.021683631,0.020245226,0.017247427,0.017032338,0.01037131,-0.036296222,-0.026334926,0.041135717,0.009625221,0.032155763,-0.025057837,0.027827105,-0.03323121,0.0055721425,0.005716655,0.01791958,0.012078577,-0.011117399,-0.0016005626,-0.0033254733,-0.007702865,0.034306653,0.0063854465,-0.009524398,0.006069535,0.012696956,-0.0042883316,-0.013167463,-0.0024667988,-0.02356566,0.00052721944,-0.008858967,0.039630096,-0.0064593833,-0.0016728189,-0.0020366213,0.00622413,-0.03739855,0.0028616884,-0.0102301575,0.017717933,-0.0041068504,-0.0060896995,-0.01876649,0.0069903834,0.025595559,0.029762903,-0.006388807,0.017247427,0.0022080203,-0.029117636,-0.029870447,-0.0049739266,-0.011809715,0.023243025,0.009510955,0.030004878,0.0015837587,-0.018524516,0.007931396,-0.03589293,0.013590919,-0.026361812,0.002922182,0.025743432,0.014894894,0.0012989342,-0.0016232478,0.006251016,0.029789789,-0.004664737,0.017812036,-0.013436324,-0.0102301575,0.016884465,-0.017220542,0.010156221,0.00014503786,0.03933435,0.018658947,0.016897907,0.0076961434,-0.029843561,-0.02021834,0.015056211,0.01002179,-0.0031994449,-0.03796316,-0.008133043,0.03707592,0.032128878,9.483648E-05,0.0017627194,-0.0007544909,0.006647586,0.020903936,-0.032559056,0.025272924,-0.012804501,0.019210111,0.0022987607,0.013301893,-0.0047218697,-0.022853177,-0.02162986,0.006788738,0.0092286505,0.024184039,-0.015419173,-0.006479548,-0.00180977,0.0060728956,-0.0030919004,0.0022449887,-0.004046357,0.012663349,-0.028579915,0.0047722813,-0.6775295,-0.018779935,-0.018484188,-0.017449073,-0.01805401,0.026630674,0.008018777,0.013436324,-0.0034683058,0.00070912065,-0.005027699,0.009658828,-0.0031792803,-0.010478854,0.0034951917,-0.011594627,0.02441257,-0.042533796,-0.012414653,0.006261098,-0.012266779,0.026630674,-0.017852364,-0.02184495,0.02176429,0.019263884,0.00984031,-0.012609577,-0.01907568,-0.020231783,-0.002886894,0.02706085,-0.0042345594,0.02265153,0.05769755,0.021522315,-0.014195856,0.011144285,0.0038077426,0.024573887,-0.03578539,-0.004476534,0.016521502,-0.019815048,0.00071836275,0.008173372,0.013436324,0.021885278,-0.0147604635,-0.021777734,0.0052595916,-0.011668564,-0.02356566,-0.0049974523,0.03473683,-0.0255149,0.012831387,-0.009658828,-0.0031036632,-0.001386314,-0.01385978,0.008294359,-0.02512505,-0.0012308789,0.008711093,0.03610802,0.016225755,0.014034539,0.0032431346,-0.017852364,0.017906137,0.005787231,-0.03514012,0.017207097,-0.0019542826,-0.010189828,0.010808208,-0.017408744,-0.0074944976,0.011009854,0.00887241,0.009652107,-0.0062409337,0.009766373,0.009759651,-0.0020819916,-0.02599885,0.0040665213,0.016064439,-0.019035352,-0.013604362,0.020231783,-0.025272924,-0.01196431,-0.01509654,0.0010233518,-0.00869765,-0.01064017,0.005249509,-0.036807057,0.00054570363,0.0021777733,-0.009302587,-0.00039362916,0.011386259,0.013382551,0.03046194,0.0032380936,0.037801843,-0.036807057,-0.006244295,0.002392862,-0.01346321,-0.008953068,-0.0025861058,-0.022853177,0.018242212,-0.0031624765,0.009880639,-0.0017341529,0.0072054723,0.014693249,0.026630674,0.008435511,-0.012562525,0.011581183,-0.0028768117,-0.01059312,-0.027746446,0.0077969665,2.468059E-05,-0.011151006,0.0152712995,-0.01761039,0.023256468,0.0076625356,0.0026163526,-0.028795004,0.0025877862,-0.017583502,-0.016588718,0.017556617,0.00075491105,0.0075885993,-0.011722336,-0.010620005,-0.017274313,-0.008025498,-0.036376882,0.009457182,-0.007265966,-0.0048663826,-0.00494368,0.003616179,0.0067820163,0.0033775652,-0.016037554,0.0043320213,-0.007978448,-0.012925488,0.029413383,-0.00016583256,-0.018040568,0.004180787,-0.011453475,-0.013886666,-0.0072121937,0.006486269,0.008005333,-0.01412864,-0.00061796,-0.025635887,-0.006630782,0.02074262,-0.007192029,0.03906549,-0.0030885397,-0.00088976155,-0.022033151,-0.008758144,0.00049361185,0.009342916,-0.014988995,-0.008704372,0.014276514,-0.012300386,-0.0020063745,0.030892119,-0.010532626,0.019653732,0.0028583275,0.006163636,0.0071517,-0.017489402,-0.008448954,-0.004352186,0.013201071,0.01090231,0.0004110631,0.03306989,0.006916447,0.002922182,0.023888292,-0.009067334,0.012434817,-0.051298663,0.016279528,-0.02741037,0.026227381,-0.005182294,0.008153207,-0.026603786,0.0045571923,0.018067453,0.038016934,0.028042194,0.0077431942,0.015499831,-0.020298999,0.0013123773,-0.021334114,-0.026281154,-0.0012720482,-0.0045571923,0.006086339,0.0028952959,-0.003041489,0.007931396,-0.0005406625,-0.023444671,-0.0038715971,0.0070374343,-0.0019979726,0.024089938,0.0020903936,-0.024210924,0.007319738,-0.005995598,0.032478396,0.020998036,0.01654839,0.033876475,0.025098165,0.021132467,-0.017099554,-0.013516982,0.01306664,0.010525905,-0.02335057,-0.013543868,-0.03583916,0.021172797,-0.033607613,-0.0036094578,-0.007911232,-0.0054578763,0.013227956,0.00993441,0.025810648,0.02255743,-0.013678298,0.012273501,0.00040497174,0.0019072321,0.0008170851,0.01540573,0.015580489,0.005239427,0.003989224,-0.013254843,0.024708318,0.0046680975,-0.034360424,-0.0041942303,0.0077095865,-0.0053503322,-0.024399128,-0.02644247,0.0062476555,0.021885278,-0.0010922474,-0.014209299,0.018295985,0.0135640325,0.0033842868,0.0017812036,0.004735313,0.006486269,-0.008072549,0.009551284,0.007938119,0.0101696635,0.021750847,0.014034539,0.0071449787,-0.008448954,0.010841816,-0.008274195,-0.014531932,-0.0024785616,0.0018601815,0.009564727,-0.011130841,-0.020581303,0.012985982,0.019976366,-0.030542599,-0.021818062,-0.018551402,-0.0092286505,-0.024385685,0.0036901159,-0.0061367503,-0.00034048714,-0.007057599,-0.014558818,-0.022221355,0.023377456,0.026119838,-0.0008813597,0.004520224,0.0027843907,-0.022382671,0.0018248934,0.13313992,0.013685021,-6.170148E-05,0.015876237,0.005417547,-0.008314524,-0.019169783,-0.016494617,0.016844137,-0.0046412116,0.024305027,-0.027827105,0.023162367,0.0143034,-0.0029893972,-0.014626034,-0.018215327,0.0073264595,0.024331912,-0.0070777633,-0.0004259765,-0.00042345593,-0.0034262962,-0.00423792,-0.016185427,-0.017946465,-5.9706024E-05,0.016467731,-0.014773907,-0.022664975,-0.009322752,-0.027585128,0.0020651878,-0.010532626,-0.010546069,0.009174879,-0.0011098915,0.026469355,0.022006266,-0.013039754,0.023458114,0.005481402,-0.00050705485,-0.012092019,0.0055990284,-0.007057599,-0.012266779,0.03253217,0.007071042,-0.01699201,0.06597847,-0.013436324,0.0070038266,-0.009981461,0.024829306,0.0067383265,0.0056292755,0.0018534599,-0.020057024,0.011735778,0.0025491375,-0.022194467,0.0012468424,-0.0051621296,-0.018457301,-0.008509448,-0.011594627,-0.0152712995,-0.001858501,-0.014921781,-0.0056696045,-0.0066979975,-0.02008391,0.0040093884,0.032935463,-0.0032935461,-0.0074205613,-0.014088311,-0.0014762144,-0.011218221,0.011984475,-0.01898158,-0.027208723,-0.008072549,0.010942639,0.0183632,0.04148524,-0.0009922648,-0.017086111,0.013483374,0.019841935,0.024264697,0.011601348,-0.0077431942,-0.020258669,-0.005770427,0.013429603,-0.011554297,-0.012831387,-1.4752561E-06,0.011594627,-0.012683514,-0.012824666,0.02180462,0.011023297,0.012468425,-0.0029860365,-0.0076289284,-0.021293784,0.005068028,0.017812036,0.0007708746,-0.008684208,0.0048126103,-0.0076558143,0.019169783,-0.0076558143,0.028579915,-0.011574462,-0.03196756,-0.0011334168,-0.030219967,0.023901735,0.014021097,-0.016776921,0.0030045207,-0.0019257163,-0.023579102,0.004197591,0.00012497831,-0.016803807,0.01915634,-0.010472132,-0.042130504,-0.038016934,-0.007702865,-0.0025861058,-0.010512462,-0.013537147,-0.013382551,-0.0036397045,0.0053032814,0.0046277684,-0.021952493,-0.016588718,-0.031886905,0.0058208387,-0.00043689896,-0.01337583,0.018349757,0.015244413,0.00900684,-0.017677605,0.01523097,0.010337702,-0.024426013,-0.021965936,-0.014182413,0.008596827,0.029628472,0.058611676,-0.015446059,0.021374442,-0.0095042335,0.00091748784,0.021132467,-0.011285436,-0.0035724894,-0.027907763,0.027302826,0.004184148,0.026281154,-0.0026802071,-0.015163755,0.005699851,0.023122039,0.0075415485,-0.020057024,-0.0109359175,-0.018309427,0.017529732,0.0020685487,-0.012441538,0.0023239665,0.012038247,-0.017543174,0.029332725,0.01399421,-0.0092488155,-1.0607403E-05,0.019371428,-0.0315105,0.023471557,-0.009430297,0.00022097006,0.013301893,-0.020110795,-0.0072928523,0.007649093,0.011547576,0.026805433,-0.01461259,-0.018968137,-0.0104250815,0.0005646079,0.031456728,-0.0020147765,-0.024224367,0.002431511,-0.019371428,-0.025017507,-0.02365976,-0.004318578,-0.04457714,0.0029826758,-0.020473758,-0.016118212,-0.00068181445,-0.03446797,-0.020715732,-0.04256068,-0.013792564,0.013873223,0.011413146,-0.002419748,0.0123877665,-0.0011115718,0.007978448,0.021441657,0.004405958,0.0042480025,0.022920392,-0.0067920987,0.011083791,-0.017529732,-0.03659197,-0.0066005355,-0.023888292,-0.016521502,0.009591613,-0.0008590946,0.013846337,-0.021092137,-0.012562525,-0.0028415236,0.02882189,5.3378342E-05,-0.006943333,-0.012226449,-0.035570297,-0.024547001,0.022355784,-0.018416973,0.014209299,0.010035234,0.0046916227,0.009672271,-0.00067635323,-0.024815861,0.0007049197,0.0017055863,-0.0051251613,0.0019391594,0.027665788,-0.007306295,-0.013369109,0.006308149,0.009699157,0.000940173,0.024842748,0.017220542,-0.0053032814,-0.008395182,0.011359373,0.013214514,0.0062711807,0.004110211,-0.019277327,-0.01412864,-0.009322752,0.007124814,0.0035119955,-0.024036165,-0.012831387,-0.006734966,-0.0019694061,-0.025367027,-0.006630782,0.016010666,0.0018534599,-0.0030717358,-0.017717933,0.008489283,0.010875423,-0.0028700903,0.0121323485,0.004930237,0.009947853,-0.02992422,0.021777734,0.00015081417,0.010344423,0.0017543174,0.006166997,-0.0015467904,0.010089005,0.0111711705,-0.010740994,-0.016965123,-0.006771934,0.014464716,0.007192029,-0.0006175399,-0.010855259,-0.003787578,0.015647706,0.01002179,-0.015378844,-0.01598378,0.015741806,-0.0039119264,-0.008422068,0.03253217,-0.019210111,-0.014975552,0.0025810648,0.0035556855,8.449164E-05,-0.034172222,-0.006395529,-0.0036867552,0.020769505,0.009766373,-0.017543174,-0.013557311,0.0031994449,-0.0014577302,0.01832287,-0.009907524,-0.024654545,0.0049940916,0.016965123,0.004476534,0.022261683,-0.009369803,0.0015308268,-0.010102449,-0.001209874,-0.023807634,-0.008348132,-0.020312442,0.030892119,-0.0058309208,-0.005128522,-0.02437224,0.01478735,-0.011016576,-0.010290652,-0.00503106,0.016884465,0.02132067,-0.014236185,-0.004903351,0.01902191,0.0028179984,0.019505858,-0.021535758,-0.0038514326,0.0112115,0.0038682362,0.003217929,-0.0012770894,-0.013685021,-0.008381739,0.0025256122,0.029386498,0.018645504,0.005323446,-0.0032784226,-0.0043253,0.0007998612,0.019949479,0.025770318,-0.0030868594,0.018968137,-0.010236879,-0.005370497,-0.024748646,-0.014047982,0.005760345,-0.03610802,0.0042009517,-0.0034817487,0.003385967,0.006560206,-0.006294706,-0.02400928,-0.006140111,-0.0017980073,-0.012481867,-0.0033960494,-0.00097210024,0.014061426,-0.017596947,-0.023202697,0.0028499255,-0.016010666,-0.028149737,0.0024752007,-0.018941252,0.0056158323,-0.012912045,0.0054410724,0.003054932,0.019559631,-0.0048932685,-0.007823853,-0.017099554,0.025662774,0.02572999,0.004379072,-0.010223436,0.0031036632,-0.011755943,-0.025622444,-0.030623257,0.019895706,-0.02052753,-0.006637504,-0.001231719,-0.013980767,-0.02706085,-0.012071854,-0.0041370974,-0.008885853,0.0001885177,0.2460615,-0.009389968,-0.010714107,0.0326666,0.0009561366,0.022624645,0.009793258,0.019452088,-0.004493338,-0.007097928,-0.0022298652,0.012401209,-0.0036229007,-0.00023819396,-0.017502844,-0.014209299,-0.030542599,-0.004863022,0.005128522,-0.03081146,0.02118624,-0.0042177555,0.0032448152,-0.019936036,0.015311629,0.0070508774,-0.02021834,0.0016148458,0.04317906,0.01385978,0.004211034,-0.02534014,-0.00030309867,-0.011930703,-0.00207527,-0.021643303,0.01575525,-0.0042883316,0.0069231684,0.017946465,0.03081146,0.0043857936,3.646951E-05,-0.0214551,0.0089933975,0.022785962,-0.008106156,0.00082884775,-0.0006717322,-0.0025457768,-0.017059224,-0.035113234,0.054982055,0.021266898,-0.0071046497,-0.012636462,0.016965123,0.01902191,-0.0061737187,0.00076247274,0.0002789432,0.030112421,-0.0026768465,0.0015207445,-0.004926876,0.0067551304,-0.022624645,0.0005003333,0.0035523248,-0.0041337362,0.011634956,-0.0183632,-0.02820351,-0.0061737187,-0.022355784,-0.03796316,0.041888528,0.019626847,0.02211381,0.001474534,0.0037640526,0.0085228905,0.013140577,0.012616298,-0.010599841,-0.022920392,0.011278715,-0.011493804,-0.0044966987,-0.028741231,0.015782135,-0.011500525,-0.00027621258,-0.0046378504,-0.003280103,0.026993636,0.0109359175,0.027168395,0.014370616,-0.011890373,-0.020648519,-0.03465617,0.001964365,0.034064677,-0.02162986,-0.01081493,0.014397502,0.008038941,0.029789789,-0.012044969,0.0038379894,-0.011245107,0.0048193317,-0.0048563,0.0142899575,0.009779816,0.0058510853,-0.026845763,0.013281729,-0.0005818318,0.009685714,-0.020231783,-0.004197591,0.015593933,-0.016319858,-0.019492416,-0.008314524,0.014693249,0.013617805,-0.02917141,-0.0052058194,-0.0061838008,0.0072726877,-0.010149499,-0.019035352,0.0070374343,-0.0023138842,0.0026583623,-0.00034111727,0.0019038713,0.025945077,-0.014693249,0.009820145,-0.0037506097,0.00041127318,-0.024909964,0.008603549,-0.0041707046,0.019398315,-0.024022723,-0.013409438,-0.027880875,0.0023558936,-0.024237812,0.034172222,-0.006251016,-0.048152987,-0.01523097,-0.002308843,-0.013691742,-0.02688609,0.007810409,0.011513968,-0.006647586,-0.011735778,0.0017408744,-0.17422187,0.01301959,0.018860593,-0.00068013405,0.008791751,-0.031618044,0.017946465,0.011735778,-0.03129541,0.0033607613,0.0072861305,0.008227143,-0.018443858,-0.014007653,0.009961297,0.006284624,-0.024815861,0.012676792,0.014222742,0.0036632298,0.0028364826,-0.012320551,-0.0050478633,0.011729057,0.023135481,0.025945077,0.005676326,-0.007192029,0.0015308268,-0.019492416,-0.008932903,-0.021737404,0.012925488,0.008092714,0.03245151,-0.009457182,-0.018524516,0.0025188907,-0.008569942,0.0022769158,-0.004617686,0.01315402,0.024291582,-0.001880346,0.0014274834,0.04277577,0.010216715,-0.018699275,0.018645504,0.008059106,0.02997799,-0.021576088,0.004846218,0.015741806,0.0023542133,0.03142984,0.01372535,0.01598378,0.001151901,-0.012246614,-0.004184148,-0.023605987,0.008657321,-0.025770318,-0.019048795,-0.023054823,0.005535174,-0.018161554,-0.019761277,0.01385978,-0.016655933,0.01416897,0.015311629,0.008919461,0.0077499156,0.023888292,0.015257857,0.009087498,0.0017845642,0.0013762318,-0.023713533,0.027464142,-0.014021097,-0.024681432,-0.006741687,0.0016450927,-0.005804035,-0.002821359,0.0056796866,-0.023189254,0.00723908,-0.013483374,-0.018390086,-0.018847149,0.0061905226,0.033365637,0.008489283,0.015257857,0.019694062,-0.03019308,-0.012253336,0.0021744126,-0.00754827,0.01929077,0.025044393,0.017677605,0.02503095,0.028579915,0.01774482,0.0029961187,-0.019895706,0.001165344,-0.0075281053,0.02105181,-0.009221929,0.023404341,-0.0028079161,-0.0037237236,0.02847237,0.0009821824,0.04629785,-0.017771706,-0.038904175,0.00869765,0.0016249281,0.020984594,-0.10867358,-0.008395182,-0.0010830053,0.008059106,-0.020097353,0.0020383017,0.008038941,-0.009047169,-0.007252523,0.0286068,-0.0037774958,-0.024923407,0.005279756,-0.009524398,0.011527412,-0.0020198175,0.019452088,0.014384058,-0.025609002,0.006025845,-0.030542599,0.016790364,0.019223554,-0.012434817,0.003901844,-0.007817131,-0.027612016,0.008314524,0.007938119,-0.0004868903,0.014747021,-0.009457182,0.014706692,-0.018847149,0.015311629,0.015647706,-0.0031288688,-0.0032717013,0.008879132,-0.034629285,0.0090337265,0.004382433,0.011305601,-0.028391711,0.0053268066,0.0003566608,-0.019169783,0.011507247,0.023592545,-0.006603896,-0.009685714,0.010714107,-0.027907763,0.006412333,0.0045706355,-0.029816674,0.0047958065,0.0018500991,-0.011500525,0.0030179636,0.015997224,-0.022140697,-0.0001849469,-0.014263071,0.011540854,-0.006607257,-0.01871272,-0.0038480717,-0.0024903242,-0.031214751,-0.0050478633,0.021481987,-0.012912045,0.028122852,-0.018605174,-0.00723908,0.0023609349,-0.0073331813,0.014935223,-0.005699851,-0.0068895607,-0.015244413,0.029789789,-0.02458733,0.0004453009,0.0015577129,0.0048596608,0.009376524,-0.011984475,-0.014518489,0.015647706,0.0068794787,0.0065534846,0.003107024,-0.01973439,0.027383484,-0.015459502,-0.006318231,0.020863606,-0.0021357639,-0.0076692575,-0.021266898,-0.046862457,0.025326697,0.016521502,-0.0036833945,0.0029860365,-0.016306413,0.026496243,-0.016803807,0.008724537,-0.0025407355,-0.027302826,0.017798591,0.0060796174,-0.014007653,-0.01650806,-0.0095042335,0.009242094,-0.009342916,0.010330981,0.009544563,0.018591732,0.0036867552,0.0194252,0.0092488155,-0.007823853,0.0015501512,-0.012031525,0.010203271,-0.0074272826,-0.020258669,0.025662774,-0.03032751,0.014854565,0.010835094,0.0007708746,0.0009989863,-0.014007653,-0.012871716,0.023444671,0.03323121,-0.034575514,-0.024291582,0.011634956,-0.025958521,-0.01973439,0.0029742739,0.0067148013,0.0022399474,0.011802994,0.011151006,-0.0116416775,0.030166194,0.013039754,-0.022517102,-0.011466918,-0.0033053088,0.006156915,0.004829414,0.006029206,-0.016534945,0.015325071,-0.0109359175,0.032854803,-0.001010749,0.0021155993,-0.011702171,-0.009766373,0.00679882,0.0040900465,-0.019438643,-0.006758491,-0.0040060277,0.022436442,0.025850976,0.006150193,0.018632062,-0.0077230297,-0.015298186,-0.017381858,0.01911601,-0.005763706,-0.0022281848,-0.031994447,0.0015972018,0.028848775,0.014572261,-0.0073264595,-0.009551284,-0.0052058194,0.014518489,-0.0041068504,0.010754436,0.0055519775,-0.005804035,-0.0054007433,0.028579915,-0.01791958,-0.015284742,0.036807057,0.015069654,-0.0023810994,-0.0038648755,0.0015467904,-0.0037136413,0.0023458113,0.019008467,-0.011547576,-0.010001626,0.012347437,0.0155267175,0.01907568,-0.003041489,-0.0132414,0.017449073,0.00060073606,-0.008536334,0.008233866,-0.0085430555,-0.02365976,0.024089938,-0.0034615842,-0.006580371,0.008327967,-0.01509654,0.009692436,0.025635887,0.0020282194,-0.04022159,-0.0021290423,-0.012407931,-0.0021727323,0.006506434,-0.005320085,-0.008240587,0.020984594,-0.014491603,0.003592654,0.0072121937,-0.03081146,0.043770555,0.009302587,-0.003217929,0.019008467,-0.011271994,0.02917141,0.0019576435,-0.0077431942,-0.0030448497,-0.023726976,0.023377456,-0.006382086,0.025716545,-0.017341528,0.0035556855,-0.019129453,-0.004311857,-0.003253217,-0.014935223,0.0036363439,0.018121226,-0.0066543072,0.02458733,0.0035691285,0.0039085653,-0.014209299,0.020191453,0.0357585,0.007830574,-0.024130266,-0.008912739,0.008314524,-0.0346024,-0.0014005973,-0.006788738,-0.021777734,0.010465411,-0.004012749,-0.00679882,0.009981461,-0.026227381,0.027033964,-0.015567047,-0.0063115098,0.0023071626,0.01037131,0.015741806,-0.020635074,-0.012945653], 7 "path": "plot_embedding", 8 "filter": { 9 "range": { 10 "lte": ISODate("1971-06-30 00:27:59.177000000"), 11 "path": "released" 12 } 13 }, 14 "k": 5 15 } 16 } 17 }, 18 { 19 "$project": { 20 "_id": 0, 21 "title": 1, 22 "plot": 1, 23 "released": 1, 24 "score": { $meta: "searchScore" } 25 } 26 } 27 ])
1 [ 2 { 3 plot: 'A poor boy wins the opportunity to tour the most eccentric and wonderful candy factory of all.', 4 title: 'Willy Wonka & the Chocolate Factory', 5 released: ISODate("1971-06-30T00:00:00.000Z"), 6 score: 0.9999985694885254 7 }, 8 { 9 plot: 'A down-on-his-luck inventor turns a broken-down Grand Prix car into a fancy vehicle for his children, and then they go off on a magical fantasy adventure to save their grandfather in a far-off land.', 10 title: 'Chitty Chitty Bang Bang', 11 released: ISODate("1968-12-18T00:00:00.000Z"), 12 score: 0.7576897740364075 13 }, 14 { 15 plot: 'A red balloon with a life of its own follows a little boy around the streets of Paris.', 16 title: 'The Red Balloon', 17 released: ISODate("1957-03-11T00:00:00.000Z"), 18 score: 0.7515948414802551 19 }, 20 { 21 plot: 'While hearing the story of "Gulliver's Travels", a young boy dreams he is the title character on the island of Lilliput .', 22 title: 'The New Gulliver', 23 released: ISODate("1935-11-03T00:00:00.000Z"), 24 score: 0.7495509386062622 25 }, 26 { 27 plot: 'A living puppet, with the help of a cricket as his conscience, must prove himself worthy to become a real boy.', 28 title: 'Pinocchio', 29 released: ISODate("1940-02-23T00:00:00.000Z"), 30 score: 0.7472590804100037 31 } 32 ]
Atlas Search 根据小于或等于1971-06-30
的released
字段值筛选文档。它对标题为Willy Wonka & the Chocolate Factory
的文档得分较高,因为它与filter
选项中的搜索条件以及查询中的vector
维度匹配。