Search operators
Overview
Weaviate offers multiple vector search "operators", through which you can carry out vector searches. Typically, our users use one of nearVector
, nearObject
or near<Media>
methods (e.g. nearText
). We will review those methods one by one in this section.
nearVector
The nearVector
operator can be used to look for objects which are the most similar to an explicitly provided vector.
The vector value is passed using the vector
argument as shown below.
Example
The vector shown below is truncated. If you would like to run the cell yourself, you can see the full vector below.
See the whole vector
[0.023932384327054024, -0.014095712453126907, 0.013304559513926506, -0.01155742909759283, -0.01147831417620182, 0.015321999788284302, -0.025013625621795654, -0.04198386147618294, 0.0006061387248337269, -0.008940030820667744, 0.013475975953042507, 0.0021558923181146383, 0.008148877881467342, -0.0022696207743138075, 0.014623147435486317, 0.0010969009017571807, 0.032199934124946594, -0.016746075823903084, 0.007700557820498943, 0.014293501153588295, -0.004793069791048765, 0.009223527275025845, 0.01840749755501747, -0.007628035265952349, -0.0017108687898144126, -0.001233704504556954, 0.01867121458053589, -0.030696744099259377, 0.012150794267654419, -0.003728309413418174, 0.030512141063809395, -0.004667803645133972, -0.005402917042374611, -0.013779250904917717, -0.013344116508960724, -0.026727791875600815, 0.020596355199813843, -0.008043390698730946, -0.0035865609534084797, -0.007120378781110048, 0.0073379455134272575, 0.031145064160227776, -0.009137819521129131, -0.00028988346457481384, -0.009823485277593136, 0.007482990622520447, 0.0011644785990938544, -0.012856239452958107, 0.001305402722209692, 0.007911532185971737, 0.011432163417339325, 0.033914100378751755, -0.0353645458817482, -0.013845180161297321, -0.009896007366478443, -0.009717998094856739, -0.022824769839644432, 0.008280736394226551, 0.029299039393663406, -0.02130839228630066, 0.008485117927193642, 0.004756808280944824, -0.021071046590805054, 0.03462613746523857, -0.021756712347269058, 0.0076082563027739525, 0.0020471089519560337, -0.013205665163695812, 0.00041803380008786917, 0.0013144679833203554, 0.019475553184747696, 0.0022762136068195105, -0.001709220465272665, -0.0005315560265444219, 0.0039063189178705215, -0.027110181748867035, 0.008676312863826752, -0.009843263775110245, -0.02209954522550106, 0.012394732795655727, 0.016772447153925896, -0.016179082915186882, -0.012078272178769112, 0.018684400245547295, 0.02439389005303383, 0.021321577951312065, -0.012282652780413628, 0.013726507313549519, -0.030169308185577393, -0.007898345589637756, 0.0166669599711895, 0.0005167219205759466, -0.0011076144874095917, 0.028085937723517418, -0.004760105162858963, 0.0016292810905724764, -0.0074698044918477535, 0.02565973438322544, 0.0024525749031454325, -0.036393046379089355, -0.01155742909759283, 0.013937481679022312, -0.025527875870466232, -0.023549992591142654, -0.014201199635863304, -0.005650152452290058, 0.011267339810729027, 0.022152289748191833, 0.025686105713248253, -0.01213101577013731, 0.011418977752327919, 0.021743526682257652, -6.031512748450041e-05, -0.010172910988330841, -0.010120167396962643, -0.026450887322425842, 0.020042547956109047, 0.006981926970183849, -0.012295839376747608, -0.04338156431913376, 0.023958755657076836, 0.014675891026854515, 0.022442378103733063, -0.00022127565171103925, 0.012427697889506817, 0.03164612874388695, -0.020464494824409485, -0.01867121458053589, 0.0167856328189373, -0.02187538519501686, 0.009632290340960026, 0.022297333925962448, 0.007318167015910149, -0.0076148491352796555, -0.01660103164613247, 0.018499799072742462, -0.004489794373512268, 0.007779672741889954, -0.0037349022459238768, -0.022112730890512466, 0.0036524904426187277, 0.012691415846347809, -0.015638461336493492, 0.0141352703794837, -0.017220767214894295, 0.035944726318120956, 0.01574394851922989, 0.005607298109680414, 0.009625696577131748, -0.021611668169498444, 0.013581463135778904, -0.004196408204734325, 0.013541905209422112, -0.007113785482943058, 0.0005550433997996151, 0.012889203615486622, -0.010060830973088741, 0.02295662835240364, -0.0015551104443147779, -0.007786266040056944, -0.003810721216723323, 0.003098683198913932, -0.0011685991194099188, -0.01275075227022171, 0.02200724370777607, 0.03061762824654579, 0.0014512715861201286, -0.004245855379849672, -0.01964697055518627, -0.01104977261275053, -0.018104221671819687, 0.006741284392774105, -0.038871992379426956, 0.011122294701635838, -0.017181210219860077, 0.0328855998814106, 7.489171548513696e-05, 0.004971079062670469, -0.031303294003009796, -0.023906011134386063, -0.005834754556417465, 0.003945876378566027, 0.0012196945026516914, 0.009137819521129131, -0.01106955111026764, -0.028666116297245026, 0.008768614381551743, -0.0029849549755454063, 0.010153132490813732, -0.015308814123272896, -0.0037085304502397776, -0.002592674922198057, -0.010252026841044426, 0.0013853422133252025, -0.6903074979782104, -0.03264825418591499, 0.00757529167458415, -0.021769898012280464, 0.005010636989027262, 0.013528719544410706, 0.006810510065406561, 0.008940030820667744, -0.009856450371444225, -0.00023652183881495148, -0.02009529061615467, 0.023906011134386063, -0.023958755657076836, -0.005762232467532158, -0.011689288541674614, -0.014504474587738514, 0.007080820854753256, -0.018051479011774063, 0.014385801739990711, 0.012856239452958107, -0.02067546918988228, 0.02763761766254902, 0.005946834571659565, 0.020345821976661682, 0.015335185453295708, 0.00432497076690197, 0.03797535225749016, -0.013284780085086823, -0.012803495861589909, -0.00042730511631816626, -0.007094006985425949, 0.015651647001504898, -0.012645265087485313, -0.001946566510014236, 0.05511700361967087, -0.005521589890122414, -0.003125054994598031, 0.019225021824240685, 0.009071889333426952, 0.023009371012449265, -0.008300515823066235, -0.0010746497428044677, 0.021954501047730446, 0.010100388899445534, -0.016970235854387283, 0.008485117927193642, 0.04230032488703728, -0.019541483372449875, -0.009038925170898438, -0.030643999576568604, 0.0005055963410995901, 0.03618207201361656, -0.004559020046144724, 0.014807750470936298, 0.009329014457762241, 0.019000861793756485, 0.020279893651604652, 0.019501926377415657, 0.0006320984102785587, 0.0028465031646192074, -0.000699264055583626, 0.028797974810004234, -0.02056998200714588, 0.001127393334172666, -0.014794564805924892, 0.020464494824409485, -0.0181305930018425, 0.020016174763441086, -0.016653774306178093, -0.01939643919467926, 0.029773730784654617, 0.021071046590805054, -0.013845180161297321, 0.030643999576568604, 0.014952794648706913, 0.026543188840150833, 0.025198228657245636, -0.007535734213888645, -0.017827318981289864, 0.022086359560489655, 0.0005212545511312783, -0.0073313526809215546, -0.04918335750699043, -0.024090614169836044, 0.03494259715080261, -0.004084328189492226, -0.028507886454463005, 0.009137819521129131, 0.022152289748191833, 0.009203748777508736, 0.0019432699773460627, 0.027558501809835434, -0.023760966956615448, -0.02416973002254963, 0.00514249550178647, -0.03014293685555458, -0.018486613407731056, -0.007304980885237455, 0.005656745284795761, -0.008827950805425644, 0.008623569272458553, -0.016587844118475914, 0.028929835185408592, 0.01545385830104351, -0.004028288181871176, -0.012849646620452404, 0.004885370843112469, 0.017576785758137703, 0.012988097965717316, -0.021638039499521255, -0.009553174488246441, -0.008227992802858353, -0.00912463292479515, 0.020583167672157288, -0.0167856328189373, -0.02674097754061222, 0.007858788594603539, -0.014174827374517918, 0.017352625727653503, -0.017154838889837265, 0.04003234952688217, -0.007852194830775261, 0.01170247420668602, 0.004951300099492073, -0.005396323744207621, -0.005828161723911762, 0.007970868609845638, -0.03336029127240181, -0.016930678859353065, -0.0029025431722402573, -0.0031563714146614075, 0.019739272072911263, 0.009797113947570324, -0.0014908292796462774, 0.004908446222543716, 0.008274143561720848, 0.014504474587738514, -0.019409624859690666, -0.022982999682426453, -0.021980872377753258, -0.03172524273395538, -0.0033986622001975775, -0.0009329014574177563, -0.0034052550327032804, -0.008544454351067543, -0.006929183378815651, 0.0042656343430280685, 0.0009007608750835061, -0.006569867953658104, -0.029562756419181824, -0.0016894417349249125, 0.006151216104626656, -0.0074698044918477535, 0.013528719544410706, 0.011966192163527012, -0.018776701763272285, -0.003073959844186902, -0.027743104845285416, -0.02500043995678425, -0.017339440062642097, 0.023892825469374657, 0.0060753971338272095, -0.008775207214057446, -0.0004223604337312281, -0.007219272665679455, -0.010252026841044426, -0.016640588641166687, 0.015124212019145489, -0.007713743485510349, -0.010014680214226246, 0.0026569559704512358, -0.007041263394057751, -0.014913237653672695, 0.018565727397799492, -0.017405370250344276, -0.0010021273046731949, 0.0036030435003340244, 0.00573915708810091, -0.0007532437448389828, -3.229512003599666e-05, -0.010898134671151638, -0.007839009165763855, 0.001443030429072678, 0.004476608242839575, 0.015137397684156895, 0.01714165136218071, 0.03380861133337021, 0.016113152727484703, -0.009447687305510044, 0.022020429372787476, -0.005152385216206312, 0.03586561232805252, 0.006688540801405907, -0.002876171376556158, -0.012816681526601315, -0.0023124748840928078, -0.001210629241541028, -0.020978745073080063, 0.0031217585783451796, 0.018750330433249474, 0.009487245231866837, -0.022152289748191833, 0.007806044537574053, -0.02025352045893669, 0.004793069791048765, -0.016139524057507515, -0.019950246438384056, -0.029773730784654617, 0.01933050900697708, -0.012955132871866226, 0.008115912787616253, 0.0029651762451976538, 0.002904191380366683, 0.012928761541843414, 0.034837111830711365, 0.019198650494217873, -0.017919618636369705, 0.010977250523865223, -0.02038538083434105, -0.005564444232732058, -0.023892825469374657, 0.01181455422192812, 0.01020587608218193, -0.007812637835741043, -0.008181842043995857, 0.02079414203763008, -0.01039707101881504, -0.011564021930098534, 0.002449278486892581, -0.038212697952985764, 0.0007363493205048144, 0.003395365783944726, -0.00129963387735188, 0.027083810418844223, 0.029615500941872597, 0.024631235748529434, -0.008794985711574554, -0.006915997248142958, 0.029167180880904198, 0.007529140915721655, -0.0042854128405451775, 0.005640262737870216, 0.029905589297413826, -0.006101768929511309, -0.004753511864691973, 0.011267339810729027, 0.01545385830104351, -0.004868888296186924, -0.012388139963150024, 0.0011809609131887555, -0.04034881293773651, -0.010627823881804943, -0.026503631845116615, 0.00977733451873064, 0.012394732795655727, -0.0054820324294269085, -0.01822289451956749, 0.006319336127489805, 0.02391919679939747, 0.024723537266254425, 0.005158978048712015, -0.0021575407590717077, 0.007456618826836348, 0.0139111103489995, 0.007502769120037556, -0.008834543637931347, -0.0024707054253667593, 0.01596810854971409, 0.002129520522430539, 0.015823064371943474, 0.00874224305152893, -0.032991088926792145, 0.011155259795486927, -0.012183759361505508, 0.020279893651604652, 0.004845813382416964, -0.0030442913994193077, -0.0077335224486887455, 0.01327818725258112, 0.006016060709953308, 0.0021047971677035093, -0.03892473503947258, 0.007212679833173752, 0.014517661184072495, -0.014082526788115501, -0.027690360322594643, 0.0006259175133891404, 0.02604212611913681, -0.0019498629262670875, 0.0015748892910778522, -0.02111060358583927, 0.001626808661967516, 0.0029388044495135546, -0.020055733621120453, -0.008794985711574554, -0.017102094367146492, 0.008485117927193642, -0.012295839376747608, 0.017985548824071884, 0.011735438369214535, -0.0017636122647672892, 0.020055733621120453, -0.0020108476746827364, -0.0040579563938081264, 0.03449427708983421, 0.020055733621120453, -0.013416639529168606, -0.016930678859353065, 0.006180884316563606, -0.009427908807992935, 0.0046381354331970215, 0.0022531382273882627, -0.013977039605379105, -0.013113363645970821, 0.0014776433818042278, -0.004338156431913376, -0.02455211989581585, -0.02500043995678425, 0.021928129717707634, -0.005890794564038515, -0.00726542342454195, -0.014174827374517918, -0.02203361690044403, -0.018842631950974464, 0.06730076670646667, -0.010416850447654724, -0.008636755868792534, 0.021044675260782242, 0.008320294320583344, -0.004657914396375418, -0.012869425117969513, -0.013871552422642708, -0.008590605109930038, -0.004275523591786623, 0.006902811583131552, 0.003566782223060727, -0.0010655844816938043, 0.005353469867259264, 0.0153747433796525, 0.019185464829206467, 0.010172910988330841, -0.011155259795486927, 0.018869003280997276, -0.014069341123104095, 0.005894090980291367, -0.027584875002503395, 0.01314632873982191, 0.018644843250513077, 0.016047224402427673, -0.029272668063640594, 0.01675926148891449, -0.000627565779723227, -0.005386434495449066, -0.03278011456131935, -0.0004099986399523914, 0.008715870790183544, -0.008214807137846947, -0.007759894244372845, 0.002576192608103156, -0.007581884507089853, 0.001857561757788062, 0.008300515823066235, 0.005468846298754215, -0.027004694566130638, 0.014412174001336098, 0.014623147435486317, -0.0011933227069675922, -0.02038538083434105, 0.0038634645752608776, -0.006042432505637407, -0.019792014732956886, 0.021980872377753258, -0.010489372536540031, -0.0018839335534721613, 0.026991508901119232, 0.009783927351236343, 0.001620215829461813, -0.03183072805404663, 0.006981926970183849, 0.0184734258800745, 0.016099967062473297, -0.0034085516817867756, -0.01962059922516346, -0.03262188285589218, -0.01043003611266613, -0.024130171164870262, 0.02410379983484745, 0.016179082915186882, -0.02067546918988228, -0.03557552024722099, -0.0009081779280677438, -0.008373037911951542, -0.0137396939098835, 0.008986181579530239, -0.008669720031321049, -0.030327538028359413, -0.004924928303807974, -0.019449181854724884, 0.007792858872562647, 0.005449067335575819, 0.02101830206811428, -0.02079414203763008, 0.019805200397968292, 0.0044172718189656734, -0.0031992257572710514, -0.0012485386105254292, 0.004555723629891872, -0.009164190851151943, -0.0008335952297784388, 0.021638039499521255, 0.0077401152811944485, 0.0009032331872731447, -0.0077401152811944485, 0.0019877722952514887, 0.014280314557254314, -0.005017229821532965, 0.007515955250710249, -0.0070148915983736515, 0.015361557714641094, 0.02041175216436386, 0.01213101577013731, -0.0013721563154831529, 0.0015946681378409266, 0.02387963980436325, 0.0044172718189656734, -0.015664832666516304, -0.002815186744555831, -0.0028184831608086824, 0.003744791727513075, 0.01179477572441101, -0.01685156300663948, 0.008946623653173447, -0.010799241252243519, -0.017497671768069267, 0.009216934442520142, -0.02919355221092701, 0.003922800999134779, -0.01774820312857628, 0.0009922379394993186, 0.008234585635364056, 0.0011100867995992303, 0.01084539107978344, -0.010528930462896824, -0.03185710310935974, -0.007311573717743158, -0.02969461679458618, 0.0046315426006913185, 0.03750066086649895, 0.006006170995533466, -0.008267550729215145, -0.009058703668415546, -0.0047699944116175175, 0.0002550644858274609, 0.0018460240680724382, -0.002813538536429405, 0.012335396371781826, -0.009520210325717926, 0.0054523637518286705, -0.03122417815029621, -0.007107192650437355, -0.007080820854753256, -0.0042788200080394745, -0.0025069667026400566, -0.007186308037489653, -0.02092600241303444, 0.0075950706377625465, 0.01189366914331913, -0.015585717745125294, -0.006797324400395155, -0.019515112042427063, -0.0021839123219251633, 0.0021377617958933115, -0.025580618530511856, 0.03014293685555458, 0.00684347515925765, 0.0008265902288258076, -0.019515112042427063, -0.028481515124440193, -0.03541729226708412, -0.0385291613638401, -0.027400271967053413, -0.026622304692864418, 0.033281177282333374, 0.02610805444419384, 0.022152289748191833, -0.017959177494049072, 0.03349215164780617, -0.0019729381892830133, 0.005725970957428217, 0.003622822230681777, 0.022666538134217262, -0.008794985711574554, -0.024288402870297432, 0.010819019749760628, 0.005656745284795761, 0.001946566510014236, 0.010759683325886726, 0.003340973984450102, 0.0007503593224100769, 0.029905589297413826, -0.016482356935739517, 0.002592674922198057, 0.0033063609153032303, -0.027769476175308228, -0.011517872102558613, 0.0021328171715140343, -0.007542327046394348, -0.0033162503968924284, -0.012249688617885113, -0.01758997142314911, 0.03354489430785179, 0.025738850235939026, -0.005623780656605959, -0.0001497834309702739, 0.0182492658495903, -0.011735438369214535, 0.041772887110710144, -0.012506812810897827, 0.02153255231678486, -0.008834543637931347, -0.0038239071145653725, -0.002765739569440484, 0.011616765521466732, -0.0022383041214197874, 0.015823064371943474, 0.002080073580145836, 0.0016836728900671005, 0.02219184674322605, 0.0013350709341466427, 0.0074698044918477535, 0.0013152922037988901, 0.011854112148284912, 0.004334860015660524, -0.022125916555523872, -0.006457787938416004, -0.021888570860028267, -0.00907848309725523, -0.03889836370944977, -0.01592855155467987, -0.011715659871697426, 0.009731183759868145, 0.038397300988435745, -0.03934668377041817, -0.011339861899614334, 0.011821147054433823, -0.011102516204118729, 0.021123789250850677, 0.0019317322876304388, 0.02385326847434044, 0.032068073749542236, -0.011801368556916714, -0.014267128892242908, -0.02254786528646946, -0.017022978514432907, -0.005297429859638214, 0.014346243813633919, 0.013581463135778904, -0.0009889415232464671, -0.024209287017583847, -0.0007462387438863516, 0.0018921747105196118, -0.02705743908882141, -0.022244589403271675, 0.0153747433796525, 0.004483201541006565, 0.025910265743732452, -0.0155989034101367, -0.008373037911951542, -0.008168656378984451, 0.021123789250850677, 0.016231825575232506, -0.00213446537964046, -0.01660103164613247, -0.017128465697169304, -0.01694386452436447, 0.014952794648706913, 0.0010252026841044426, 0.010997029021382332, 0.008623569272458553, -0.006438008975237608, 0.0176822729408741, 0.004687582608312368, 0.009487245231866837, 0.0012749104062095284, -0.012572742998600006, 0.03132966533303261, 0.006352300755679607, 0.03148789703845978, 0.007957682013511658, 0.0002802000963129103, 0.01022565457969904, -0.00923671294003725, 0.0007136861095204949, 0.02903532236814499, -0.015387929044663906, -0.010680567473173141, 0.010515743866562843, 0.0028943021316081285, 0.0184734258800745, -0.005538072437047958, -0.0017174617387354374, 0.015229698270559311, -0.00958613958209753, 0.0035634858068078756, 0.01669333130121231, 0.0015963163459673524, -0.0008438967051915824, -0.019225021824240685, -0.004601874388754368, 0.009467466734349728, -0.025105927139520645, -0.010278398171067238, 0.01583625003695488, -0.026701420545578003, -0.020490868017077446, -0.010074017569422722, 0.0018114111153408885, 0.008584012277424335, -0.02572566457092762, 0.00958613958209753, -0.0032272457610815763, 0.025606991723179817, -0.03539091721177101, 0.016271384432911873, 0.018077850341796875, 0.022297333925962448, -0.020016174763441086, 0.004430457949638367, 0.0136869503185153, -0.011768403463065624, 0.015783505514264107, -0.011867297813296318, -0.0135155338793993, -0.0057028960436582565, -0.012566149234771729, 0.010884949006140232, -0.008748835884034634, -0.005126013420522213, -0.02086007222533226, 0.029404526576399803, -0.0021641335915774107, -0.028217796236276627, -0.012170572765171528, 0.0013952315784990788, 0.007667592726647854, 0.014860494062304497, 0.02108423225581646, -0.039610400795936584, 0.016337312757968903, -0.022442378103733063, 0.011959598399698734, 0.003134944476187229, -0.022112730890512466, 0.01984475925564766, -0.014623147435486317, 0.0172339528799057, 0.0005542192957364023, -0.02216547541320324, -0.0029503421392291784, -0.003777756355702877, -0.014161641709506512, 0.006381968967616558, -0.016904305666685104, 0.006606128998100758, 0.0135155338793993, 0.02887709066271782, 0.025606991723179817, 0.009401536546647549, 0.005946834571659565, 0.0014356133760884404, -9.935771231539547e-05, 0.0010936044855043292, -0.012684823013842106, -0.0027574985288083553, 0.020332636311650276, 0.021967686712741852, 0.014398987405002117, -0.020965559408068657, -0.010469594039022923, 0.001205684500746429, -0.018658028915524483, -0.02998470515012741, 0.0014298445312306285, -0.00483262725174427, 0.010245434008538723, 0.009197155945003033, -0.005307319108396769, 0.02536964602768421, -0.0022926959209144115, 0.01035092119127512, 0.0026800313498824835, -0.009012552909553051, 0.04053341597318649, -0.0031547232065349817, -0.006902811583131552, -0.003113517304882407, -0.031145064160227776, -0.012473848648369312, 0.010522337630391121, 0.002930563176050782, 0.011623358353972435, -0.0023306054063141346, 0.013126550242304802, 0.02718929760158062, -6.428119377233088e-05, -0.015190141275525093, -0.006711616180837154, 0.01685156300663948, 0.008438967168331146, -0.030670370906591415, -0.0014825881225988269, 0.002033923054113984, -0.007278609089553356, 0.0038964294362813234, -0.005923759192228317, 0.019805200397968292, 0.0051227170042693615, 0.004282116424292326, 0.015427486971020699, -0.034230560064315796, 0.017471298575401306, -0.040849875658750534, 0.0021542441099882126, 0.002892653690651059, 0.015321999788284302, -0.0010029515251517296, 0.010080610401928425, -0.00695555517449975, 0.01894811913371086, 0.0034645916894078255, 0.011412384919822216, -0.005719378124922514, -0.004397492855787277, 0.002235007705166936, -0.0046249497681856155, -0.011412384919822216, -0.008656534366309643, -0.00885432306677103, 0.008715870790183544, -0.014029783196747303, 0.012632079422473907, -0.007707150653004646, 0.01650873012840748, 0.023365391418337822, -0.006589646451175213, -0.022982999682426453, -0.0005290837143547833, -0.008709277957677841, -0.015704389661550522, -0.0062962607480585575, 0.0015468692872673273, -0.005379841662943363, 0.00585123710334301, -0.001642466988414526, -0.0037744599394500256, -0.010548708960413933, -0.00768737168982625, 0.008808172307908535, 0.016970235854387283, 0.023826897144317627, 0.22004607319831848, -0.025303715839982033, -0.015018724836409092, 0.03336029127240181, -0.014517661184072495, 0.018895374611020088, 0.02387963980436325, -0.004390900023281574, 0.006002874579280615, 0.014794564805924892, -0.017695458605885506, 0.027110181748867035, 0.004262337926775217, -0.00915759801864624, -0.005735860671848059, 0.0004409030661918223, -0.01917227916419506, -0.013950667344033718, 0.0026338808238506317, -0.01136623416095972, 0.007792858872562647, -0.0023685148917138577, -0.011972784996032715, -0.013192479498684406, 0.009711405262351036, -0.012730972841382027, -0.0030822008848190308, 0.0018278934294357896, 0.019027233123779297, 0.01020587608218193, 0.011155259795486927, -0.014201199635863304, -0.009902600198984146, -0.000843484653159976, 0.017563600093126297, 0.011623358353972435, 0.021387508139014244, -0.012440883554518223, 0.0011603579623624682, 0.009197155945003033, -0.022745653986930847, 0.006935776211321354, -0.009137819521129131, -0.0063094464130699635, -0.004460126161575317, -0.0011661268072202802, -0.01901404745876789, 0.010667381808161736, 0.011939819902181625, 0.009737776592373848, -0.034520652145147324, -0.014504474587738514, 0.010515743866562843, 0.04034881293773651, -0.029483642429113388, -0.0035371140111237764, 0.018750330433249474, 0.008234585635364056, -0.013752879574894905, 0.007370910607278347, 0.0017322958447039127, 0.016640588641166687, -0.016205454245209694, -0.0019531594589352608, 0.002096555894240737, 0.020266707986593246, -0.018842631950974464, -0.017669087275862694, 0.028613373637199402, 0.01806466467678547, 0.01203871425241232, 0.0010144890984520316, -0.03011656366288662, -0.0017850393196567893, -0.024538934230804443, -0.0027921113651245832, 0.011603579856455326, 0.0057984935119748116, 0.008096134290099144, 0.018262453377246857, -0.005514997057616711, -0.004799662623554468, -0.002014144090935588, -0.023760966956615448, -0.026886021718382835, -0.031303294003009796, 0.011577208526432514, -0.00917737651616335, -0.015664832666516304, 0.007819230668246746, 0.0028349654749035835, 0.006714912597090006, 0.015440672636032104, -0.004921631887555122, 0.008412595838308334, -0.0027228854596614838, 0.00585123710334301, 0.01127393264323473, -0.006378672551363707, -0.015440672636032104, -0.027611246332526207, 0.0023882936220616102, 0.0029948444571346045, -0.0015147286467254162, -0.014240757562220097, 0.0010804185876622796, -0.006546792574226856, -0.01507146842777729, 0.0015773616032674909, 0.00542269553989172, -0.005983096081763506, -0.007806044537574053, 0.008972995914518833, 0.00010152102186111733, -0.01977882906794548, 0.02140069380402565, 0.018341567367315292, -0.0009535044082440436, 0.025290530174970627, -0.0007726105395704508, -0.00203557126224041, -0.006622611545026302, 0.006935776211321354, 0.006556681822985411, -0.006658872589468956, -0.026859650388360023, -0.008096134290099144, 0.017273511737585068, -0.004041474312543869, -0.029325410723686218, -0.0063918582163751125, -0.0029025431722402573, 0.019159093499183655, -0.02378733828663826, 0.006316039711236954, 0.01930413767695427, 0.004011806100606918, -0.009355386719107628, -0.010166318155825138, -0.013416639529168606, -0.007753300946205854, 0.018170151859521866, 0.002277861814945936, 0.004948003683239222, 0.0019218429224565625, -0.01971290074288845, 0.017893247306346893, -0.002117983065545559, 0.0033508634660393, -0.02022714912891388, 0.0006386913591995835, -0.022692909464240074, -0.012302432209253311, 0.0026816795580089092, 0.03362400829792023, -0.00992237962782383, -0.01948874071240425, -0.028507886454463005, -0.0013861663173884153, 0.00684347515925765, -0.01653510145843029, 0.007542327046394348, 0.016455985605716705, -0.014372616074979305, -0.010370699688792229, 0.0004413151182234287, -0.17067810893058777, 0.013779250904917717, -0.0009724590927362442, -0.011168445460498333, 0.015308814123272896, -0.012632079422473907, -0.009408130310475826, -0.0020273299887776375, 0.006988519802689552, 0.002660252619534731, 0.006431416142731905, 0.0009312531910836697, -0.05643559247255325, -0.008748835884034634, 0.013581463135778904, 0.013344116508960724, -0.011517872102558613, 0.011768403463065624, 0.01758997142314911, -0.009282863698899746, 0.03307020291686058, -0.029615500941872597, -0.006721505429595709, -0.02079414203763008, 0.007700557820498943, -0.009526803158223629, -0.0151505833491683, 0.0028679303359240294, -0.013297966681420803, 0.0027294785249978304, -0.018552541732788086, -0.0032585621811449528, 0.04222120717167854, 0.004740326199680567, 0.03230542317032814, 0.009025739505887032, -0.008293922059237957, 0.0026849762070924044, -0.017273511737585068, 0.016034036874771118, 0.0011323379585519433, 0.020490868017077446, 0.014583590440452099, -0.0017075722571462393, -0.019963432103395462, -0.003761274041607976, -0.004628246184438467, -0.011682695709168911, 0.004687582608312368, 0.003373938612639904, 0.006368783302605152, -0.03275374323129654, -0.017220767214894295, -0.0034547022078186274, 0.037922609597444534, 0.014227570965886116, 0.024763094261288643, 0.006058914586901665, 0.007766487076878548, -0.02238963544368744, -0.028059566393494606, -0.018011920154094696, 0.001116679748520255, -0.03926756978034973, -0.0018295417539775372, -0.02423565834760666, -0.01583625003695488, 0.005432585254311562, -0.012599114328622818, 0.024116985499858856, -0.0019993099849671125, 0.0008875749772414565, 0.0007441784837283194, -0.0030162713956087828, 0.011867297813296318, 0.025422388687729836, -0.012374954298138618, 0.020504053682088852, -0.00885432306677103, -0.02500043995678425, -0.03937305510044098, 0.038871992379426956, 0.01020587608218193, -0.0008513137581758201, -0.002080073580145836, 0.0025910267140716314, -0.01583625003695488, 0.007654407061636448, -0.02194131538271904, -0.004206297919154167, 0.017181210219860077, -0.026846464723348618, 0.004921631887555122, -0.013713321648538113, 0.025870708748698235, 0.024763094261288643, 0.012236502021551132, 0.010179503820836544, 0.023576363921165466, -0.007674186024814844, -0.004203001037240028, 0.0139111103489995, 0.006550088990479708, 0.0015740651870146394, 0.031171435490250587, 0.016587844118475914, 0.014702263288199902, 3.2604162697680295e-05, 0.017985548824071884, -0.019923873245716095, 0.008293922059237957, -0.02209954522550106, -0.00284155854023993, 0.024182915687561035, -0.011148666962981224, 0.02397194132208824, -0.014095712453126907, -0.01443854533135891, 0.017537228763103485, 0.009678440168499947, 0.04754830524325371, -0.019027233123779297, -0.03043302521109581, -0.0134034538641572, -0.017260326072573662, -0.0012691415613517165, -0.09361979365348816, -0.02658274583518505, -0.006484159734100103, 0.0014405581168830395, 0.0032832857687026262, 0.005874312482774258, -0.005188646260648966, -0.00885432306677103, -0.016495544463396072, 0.014319872483611107, 0.006022653542459011, -0.02358955144882202, -0.012783716432750225, -0.020372195169329643, 0.039926864206790924, -0.0139111103489995, 0.004470015410333872, -0.013884738087654114, -0.007779672741889954, 0.018196523189544678, -0.00850489642471075, 0.002144354861229658, 0.011372826993465424, 0.008003832772374153, -0.019027233123779297, -0.006408340763300657, -0.030960461124777794, 0.028217796236276627, 0.020820515230298042, -0.007845601998269558, -0.027294784784317017, -0.002777277259156108, 0.0045425379648804665, -0.015124212019145489, -0.023985126987099648, -0.004918335471302271, 0.0015443969750776887, -0.021347949281334877, 0.028534257784485817, -0.04522759094834328, -0.012249688617885113, 0.01586262136697769, -0.0170097928494215, -0.02047768048942089, -0.005610594525933266, -0.013001283630728722, -0.0027789254672825336, 0.03014293685555458, 0.005267761647701263, -0.02734752744436264, -0.03275374323129654, -0.020082104951143265, -0.037474289536476135, 0.014148456044495106, 0.008748835884034634, 0.010443221777677536, 0.005818272475153208, 0.00779945170506835, 0.0001228965847985819, 1.5928653738228604e-05, -0.006002874579280615, 0.01020587608218193, -0.029773730784654617, 0.027822220697999, -0.007080820854753256, -0.00799723993986845, -0.03539091721177101, -0.0040579563938081264, 0.015163769014179707, -0.003744791727513075, -0.009678440168499947, 0.02302255667746067, -0.012427697889506817, 0.001398528111167252, -0.05298089236021042, -0.007001705467700958, -0.0019564558751881123, -0.006263296119868755, 0.04557042196393013, -0.008577419444918633, -0.02419610135257244, -0.00706763518974185, 0.030195679515600204, 0.00038033039891161025, 0.024314774200320244, 0.0385291613638401, 0.0186975859105587, -0.008564232848584652, 0.013647392392158508, 0.012684823013842106, -0.0033146021887660027, -0.0013803974725306034, 0.013647392392158508, -0.04330245032906532, -0.009335607290267944, 0.007839009165763855, -0.020662283524870872, -0.0015452210791409016, 0.026253100484609604, 0.020820515230298042, -0.02635858580470085, -0.0058116791769862175, -0.06608766317367554, 0.02813868224620819, 0.006896218750625849, 0.015229698270559311, 0.010258619673550129, -0.010990436188876629, 0.019673341885209084, -0.0059303524903953075, -0.0018839335534721613, 0.007944496348500252, -0.0061709946021437645, 0.01243429072201252, -0.0002400243392912671, -0.004941410850733519, 0.0034975563175976276, -0.0031481303740292788, 0.015796691179275513, 0.008458745665848255, 0.005561147350817919, 0.0002383761020610109, -0.010627823881804943, 0.021374322474002838, 0.01955466903746128, 0.002106445375829935, -0.0025646549183875322, 0.0060819899663329124, -0.01062123104929924, -0.001493301591835916, -0.01608678139746189, 0.002991548040881753, 0.014728634618222713, -0.021796269342303276, -0.024657607078552246, 0.028481515124440193, -0.028534257784485817, -0.018750330433249474, -0.014623147435486317, 0.009322421625256538, 0.005152385216206312, 0.03275374323129654, -0.007509362418204546, 0.0011076144874095917, 0.02980010211467743, 0.0032157080713659525, -0.015335185453295708, 0.01662740297615528, 0.00958613958209753, 0.022363262251019478, 0.002279510023072362, 0.011234374716877937, -0.010383885353803635, 0.026068497449159622, -0.02327308990061283, -0.004743622615933418, 0.003174502169713378, -0.006975333672016859, 0.018038293346762657, -0.0016432910924777389, -0.0019201947143301368, -0.006556681822985411, 0.02840239927172661, 0.0139111103489995, 0.017036164179444313, 0.00675776693969965, -0.0052117216400802135, -0.01860528625547886, -0.023259904235601425, -0.001598788658156991, 0.012091457843780518, -0.04541219398379326, 0.0060325427912175655, -0.014583590440452099, 0.009038925170898438, 0.0018427276518195868, -0.017603158950805664, -0.00652701361104846, 0.006922590080648661, 0.0038964294362813234, -0.029114436358213425, 0.01930413767695427, 0.03523268923163414, -0.01031795609742403, -0.036366675049066544, 0.0017339440528303385, 0.022059988230466843, 0.006006170995533466, 0.006197366397827864, 0.028771603479981422, -0.0073313526809215546, 0.010074017569422722, -0.00547873554751277, 0.003995323553681374, -0.0017388887936249375, -0.00240147951990366, -0.008880694396793842, 0.04406723380088806, -0.012790309265255928, 0.002683327766135335, 0.020833700895309448, 0.03188347443938255, -0.004288709722459316, -0.006672058254480362, 0.013304559513926506, -0.003932690713554621, -0.012315617874264717, 0.03494259715080261, -0.03125055134296417, -0.036234814673662186, -0.007239051628857851, 0.0047205472365021706, -2.2856394934933633e-05, 0.014280314557254314, 0.00726542342454195, 0.006513827946037054, -0.014280314557254314, -0.00041597351082600653, 0.005867719184607267, -0.03974226117134094, -0.02165122516453266, 0.02232370525598526, 0.0074632116593420506, 0.04622971639037132, -0.012348582036793232, -0.026028938591480255, 0.03272736817598343, 0.0184734258800745, 0.04172014445066452, 0.0034052550327032804, 0.00010394187120255083, 0.008972995914518833, 0.0014356133760884404, -0.015229698270559311, 0.002439389005303383, 0.0035041493829339743, 0.002167430007830262, 0.012684823013842106, -0.003751384560018778, 0.011755217798054218, -0.031145064160227776, 0.05263805761933327, 0.007628035265952349, -0.011175038293004036, 0.025765221565961838, -0.016165897250175476, -0.00207842537201941, 0.023233531042933464, 0.01222990918904543, -0.02795407921075821, -0.03425693139433861, 0.003929394297301769, 0.006675355136394501, 0.0353645458817482, -0.008788392879068851, -0.006975333672016859, 0.002627287758514285, -0.00023528565361630172, -0.009223527275025845, -0.013344116508960724, -0.015031910501420498, 0.027136553078889847, -0.0034876668360084295, 0.016904305666685104, 0.01662740297615528, -0.027558501809835434, -0.006975333672016859, 0.01412208378314972, 0.020359007641673088, 0.00684347515925765, -0.02347087673842907, -0.0034876668360084295, 0.00757529167458415, -0.021796269342303276, -0.026991508901119232, 0.002261379500851035, -0.0137396939098835, 0.0013045786181464791, -0.030775858089327812, 0.008452152833342552, 0.01209805067628622, 0.006411637179553509, 0.0358128659427166, -0.015242884866893291, -0.003301416290923953, -0.004516166169196367, 0.012559556402266026, -0.028323283419013023, -0.0023882936220616102, -0.0357337519526481]
- Python
- GraphQL
vector_input = [0.023932384327054024, -0.014095712453126907, ..., -0.0357337519526481]
response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2).with_near_vector(
{"vector": vector_input}
).do()
print(json.dumps(response, indent=2))
{
Get {
JeopardyQuestion (
limit: 2
nearVector: {
vector: [0.023932384327054024, -0.014095712453126907, ..., -0.0357337519526481]
}
) {
question
answer
}
}
}
Before looking at the response, or running the query, think about the following:
- How many objects do you expect the response to contain?
- What properties do you expect to see in each object?
- Can you tell what the vector represents?
See the JSON response
{
"data": {
"Get": {
"JeopardyQuestion": [
{
"answer": "escaping the Earth's gravity (and go off into outer space, on your way to the moon, for instance)",
"question": "It takes approximately 24,840 MPH to achieve this"
},
{
"answer": "the Milky Way",
"question": "This is the name of our own galaxy"
}
]
}
}
}
Explain this query
- Because there was a
limit
of 2, the results contained (maximum of) two objects. - Each object included
question
andanswer
properties, as specified in theGet
function. - And since the vector was provided externally, we have no way of telling what it represents. (Although we can infer from the results that it relates to something to do with space.)
nearObject
The nearObject
operator can be used to look for objects which are the most similar to an existing Weaviate object.
The object's identity is passed using the id
argument as shown below.
Example
- Python
- GraphQL
response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2).with_near_object(
{"id": "c8f8176c-6f9b-5461-8ab3-f3c7ce8c2f5c"}
).do()
print(json.dumps(response, indent=2))
{
Get {
JeopardyQuestion (
limit: 2
nearObject: {
id: "c8f8176c-6f9b-5461-8ab3-f3c7ce8c2f5c"
}
) {
question
answer
}
}
}
Before looking at the response, or running the query, think about the following:
- There is no vector provided here. Where does the vector come from?
See the JSON response
{
"data": {
"Get": {
"JeopardyQuestion": [
{
"answer": "escaping the Earth's gravity (and go off into outer space, on your way to the moon, for instance)",
"question": "It takes approximately 24,840 MPH to achieve this"
},
{
"answer": "66,000",
"question": "Of 6,000, 66,000 or 666,000 MPH, the closest to the speed of the Earth around the sun"
}
]
}
}
}
Explain this query
- When it comes to
nearObject
queries, Weaviate uses the vector of the object used as the query vector.
nearText
The nearText
operator can be used to look for objects which are the most similar to a text input.
The text is passed using the concept
argument as shown below.
Example
- Python
- GraphQL
response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2).with_near_text(
{"concepts": "Intergalactic travel"}
).do()
print(json.dumps(response, indent=2))
{
Get {
JeopardyQuestion (
limit: 2
nearText: {
concepts: ["Intergalactic travel"],
}
) {
question
answer
}
}
}
Before looking at the response, or running the query, think about the following:
- Once again, there is no vector provided here. Where does the vector come from this time?
See the JSON response
{
"data": {
"Get": {
"JeopardyQuestion": [
{
"answer": "escaping the Earth's gravity (and go off into outer space, on your way to the moon, for instance)",
"question": "It takes approximately 24,840 MPH to achieve this"
},
{
"answer": "the Milky Way",
"question": "This is the name of our own galaxy"
}
]
}
}
}
Explain this query
With nearText
Weaviate converts the input text to a vector.
Accordingly, nearText
requires some means of converting an input medium to a vector. This is called a vectorizer
in Weaviate.
In Weaviate, vectorizers are added as optional modules
. You will learn more about modules and vectorizers in later units.
near<Media>
You saw nearText
here as we are dealing with texts. There are additional operators available for other media, such as nearImage
for images. We refer to them generically as the near<Media>
operator.
The principle with all of these operators are the same, which is to retrieve outputs closest to the input medium.
Adding a threshold
Vector search is based on similarity, it does not inherently exclude any of the results. By default, vector search returns a system defined maximum number of results. To limit the number of results, set a threshold or limit.
Distance thresholds
A threshold value such as distance
or certainty
specifies the maximum distance (or, looked from the other direction, minimum similarity) required to retrieve an object. In this example, distance
is an additional
parameter that limits the results.
- Python
- GraphQL
response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2).with_near_text(
{"concepts": "Intergalactic travel"}
).with_additional(
["distance", "id"]
).do()
print(json.dumps(response, indent=2))
{
Get {
JeopardyQuestion (
limit: 2
nearText: {
concepts: ["Intergalactic travel"],
}
) {
question
answer
_additional {
distance
id
}
}
}
}
This is the response:
See the JSON response
{
"data": {
"Get": {
"JeopardyQuestion": [
{
"_additional": {
"distance": 0.1791926,
"id": "b1645a32-0c22-5814-8f35-58f142eadf7e"
},
"answer": "escaping the Earth's gravity (and go off into outer space, on your way to the moon, for instance)",
"question": "It takes approximately 24,840 MPH to achieve this"
},
{
"_additional": {
"distance": 0.18123823,
"id": "ef263438-b152-5540-97f7-99f4076bd124"
},
"answer": "the Milky Way",
"question": "This is the name of our own galaxy"
}
]
}
}
}
Try changing the one of the above queries to:
- Use a
certainty
threshold rather thandistance
. - Return
certainty
as well asdistance
. Do they behave as you expected?
In this context, distance
measures the degree of difference. You might also see certainty
used in some contexts. This is the opposite of distance
, where higher values imply larger differences in meaning.
We will cover later on what these values mean, exactly, and where they come form. But for now, remember that:
distance
is a measure of dissimilarity (lower is more similar), andcertainty
is a measure of similarity (higher is more similar)
limit
threshold
Several of the earlier examples use the limit
clause. Use limit
to limit the number of objects returned.
In this Python example, with_limit()
sets a limit of two responses.
response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2)
Review
Review exercise
Key takeaways
nearVector
/ nearObject
availabilityBoth nearVector
and nearObject
are available in Weaviate at all times, whereas nearText
is only available when a vectorizer module is enabled and in use.
- Multiple search operators are available to help perform vector searches.
nearVector
can be used to find objects closest to an input vector.nearObject
can be used to find objects closest to an existing Weaviate object.nearText
can be used to find objects closest to an input text.- Other
near<Media>
operators are available for other object types.
- Other
- You might use a
nearVector
query when you are using your own vectorizer, or have a library of vectors already available. AnearObject
is a useful query for finding similar objects to an existing one.
Questions and feedback
If you have any questions or feedback, let us know in the user forum.