Skip to main content

A look inside queries

Overview


In this unit, we have looked at various ways to construct a vector search.

We started by learning how to use Get and Aggregate vector search functions, adding search operators such as nearVector, nearObject and nearText, before wrapping up with various filters such as where, limit and offset.

Now let's stop to take a look at how these searches are actually performed, starting with the vector search process.

The vector search process

Vector search, behind the scenes

As the name suggests, vector search relies on vectors to perform its operations. When you perform a vector search in Weaviate, regardless of whether nearVector, nearObject or nearText is used, the input is converted to a vector.

The input vector is then compared to the stored vectors in Weaviate to return the most relevant objects.

For queries using the nearVector operator, Weaviate simply takes the provided vector and performs the vector search.

For queries such as nearObject and nearText where the vector is not directly provided, Weaviate obtains the vector using a suitable method.

nearObject

If the nearObject operator is used, Weaviate retrieves the associated vector for the object, which becomes the input vector.

Let's confirm this by performing a vector search using the nearObject operator, and replicating it with an equivalent nearVector operator.

Here is the nearObject query:

response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2).with_near_object(
{"id": "d53fd7ea-35c1-5f8d-a35a-e53511db1a2a"}
).with_additional(
["distance", "id"]
).do()

print(json.dumps(response, indent=2))
See the JSON response
{
"data": {
"Get": {
"JeopardyQuestion": [
{
"_additional": {
"distance": 3.5762787e-07,
"id": "d53fd7ea-35c1-5f8d-a35a-e53511db1a2a"
},
"answer": "meerkats",
"question": "Group of mammals seen <a href=\"http://www.j-archive.com/media/1998-06-01_J_28.jpg\" target=\"_blank\">here</a>: [like Timon in <i>The Lion King</i>]"
},
{
"_additional": {
"distance": 0.12663543,
"id": "9eaf38fe-e7f0-5da3-b703-6b44c49faf7d"
},
"answer": "hyena",
"question": "It's the amused African mammal heard <a href=\"http://www.j-archive.com/media/2006-12-14_J_10.mp3\">here</a>"
}
]
}
}
}

Now, try running this nearVector query and compare the results:

To run the nearVector query, you need to provide the full vector. You can view and copy the full vector below.


# Shortened for clarity

meerkat_vector = [-0.024790961, -0.01860295, ..., -0.008665809,-0.02698336]

This is the query.

response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2).with_near_vector(
{"vector": meerkat_vector}
).with_additional(
["distance", "id"]
).do()

print(json.dumps(response, indent=2))
See the full `meerkat_vector`

[-0.024790961,-0.01860295,-0.006920972,-0.042420954,-0.002649688,0.037932377,0.011636574,-0.018356469,-0.014788956,-0.017591074,0.017629992,-0.0016345689,0.015424622,-0.017435402,-0.0010686318,0.0056236954,0.019536989,0.013880863,0.030953025,-0.006188011,-0.0024226645,0.003998856,-0.008944724,-0.02750227,0.021820197,-0.011383604,0.014347882,-0.023805032,-0.015165167,0.015619214,-0.0012648449,-0.02000401,0.006333954,-0.020925077,-0.015735969,-0.009204179,0.011150095,-0.03832156,0.024959607,-0.007861498,-0.017201891,0.007783661,0.0070312405,-0.015281921,-0.009327421,0.0050723525,0.018992133,-0.01574894,-0.02089913,0.026438503,0.018577006,0.0120517025,-0.02482988,-0.000100589634,0.0076733925,0.0010516051,-0.003969667,-0.006074499,-0.006901513,-0.025737973,0.009736063,0.0026091482,-0.025919592,-0.0035869705,-0.013828971,-0.010443079,-0.019381316,0.007790148,0.0070247543,-0.009405257,0.03442973,0.006175038,0.006525303,0.00085620274,0.020276438,-0.01447761,-0.009710117,0.013478707,0.005724234,-0.007135023,0.025050417,-0.012434399,-0.014088427,0.027139032,0.013647352,-0.0011489008,0.012447371,0.027294705,0.011273336,0.017357565,-0.0002450637,0.027190924,0.004777222,0.011026854,0.0056690997,0.018615924,0.0022880721,0.01377708,-0.018071067,-0.01869376,-0.0029334673,0.002320504,0.011448468,-0.0044820914,-0.005030191,0.015204085,-0.019355372,-0.0061912537,0.026620122,-0.024142323,-0.02169047,0.043303102,0.030096823,-0.049348414,0.0056139654,-0.02750227,0.033340015,-0.008575,0.020938048,-0.016125152,0.03069357,0.023415847,0.018551059,-0.012395481,0.016708925,0.031549774,0.0062334156,-0.008918779,0.0009559309,-0.016890544,0.035208095,0.011253877,0.020938048,0.015359758,-0.007679879,0.029240621,-0.013141415,0.023454767,0.015268949,-0.030953025,0.007323128,0.012946824,0.009995518,0.009152289,-0.012148998,0.0377767,0.021443987,0.0073036687,-0.00943769,-0.0075177196,0.018447278,0.008464731,0.0034572429,-0.013128442,0.028021181,-0.002339963,-0.012693854,-0.001610245,-0.030200606,-0.020561839,0.018045122,0.028617928,0.021651551,0.0064831413,0.024596369,0.03092708,0.024713125,-0.0052572144,0.009781468,-0.002750227,-0.0019815904,0.00036506183,-0.00055904523,0.03655726,-0.013764108,0.03134221,-0.01555435,0.004705872,-0.0048680315,-0.036064297,-0.0319649,0.019018078,-0.0016815951,0.03058979,-0.020756429,-0.020016981,0.029655749,-0.0069923224,0.024661234,0.0015267327,0.02262451,0.015852723,-0.0046474943,-0.010300378,-0.661715,-0.00803663,-0.003030763,0.008626891,0.009359852,0.020886159,0.0054064016,0.0024032055,-0.013212765,0.02323423,-0.0142570725,-0.0065544914,0.01447761,-0.001958888,-0.031238427,-0.0124603445,0.0054031583,-0.0024502317,-0.016670007,-0.005789098,-0.0403972,0.005380456,0.008056089,0.0050139753,-0.010546861,0.010773884,0.011182527,-0.029551968,0.0024518534,0.05925961,-0.035727005,0.022832073,0.011558737,0.00023715843,0.043640394,-0.0015997045,-0.015593268,0.039151818,0.0052896463,0.025686081,-0.013686271,-0.007926362,0.016501362,-0.0064701685,5.5438315e-05,-0.00974255,0.020821294,0.015761914,-0.008497164,-0.007725284,-0.038555067,5.787071e-05,-0.012752231,0.0041934475,0.00742691,-0.0003295894,0.012090621,-0.02351963,0.00742691,0.036323752,-0.009314448,0.010280919,-0.009969573,0.014399773,-0.034455676,0.011759815,0.0018534843,0.005633425,0.022040734,-0.026464447,0.024142323,0.018615924,-0.023869894,0.0038107508,0.0135824885,0.010371729,0.0042875,-0.027606051,-0.013764108,-0.011883056,0.011831165,-0.0056269383,-0.0075501516,-0.013893835,0.026127156,-0.010293892,-0.01663109,0.004015072,0.019277534,0.017318645,0.0023659086,0.029162785,-0.0016556496,-0.010605238,-0.009431203,-0.010670102,-0.008490677,-0.0030015744,-0.0010978206,-0.028825492,-0.02445367,-0.021612633,0.01897916,-0.020159682,0.0044626324,-0.006599896,-0.017111082,0.014866793,0.03186112,-0.0117663015,-0.013880863,-0.012992227,0.0074852877,-0.016514335,0.009392285,-0.024661234,0.022481808,0.016319742,0.0085814865,-0.012752231,0.0036323753,-0.0033048128,0.023117473,-0.005620452,0.022416944,0.019316453,-0.012804123,-0.022715319,-0.03040817,0.009891736,0.0105209155,0.015567322,0.008412841,-0.0077706883,0.012265753,0.013147901,0.0092560705,-0.0096647125,0.0311087,-0.009502553,-0.0073620463,-0.0074852877,-0.0027923884,-0.021560742,-0.0005683694,-0.026697958,-0.0026399584,-0.0016751088,-0.020639675,-0.008133926,-0.023999622,-0.00628855,-0.0064961137,0.012382507,0.025621219,-0.004404255,-0.025128253,-0.0170073,0.010151192,0.004381553,0.014283018,-0.00048647882,-0.043510668,-0.008750132,-0.0050853253,-0.023441793,0.013984645,0.004381553,-0.014075454,-0.045560364,-0.007439883,-0.0070052953,-0.00092998537,-0.0016013262,-0.009937141,0.007375019,-0.003163734,-0.017642966,-0.03564917,-0.016838653,0.021586686,0.010391188,-0.0015940289,-0.013530598,0.035026476,-0.008918779,0.04685764,0.024518533,0.00077309593,0.03912587,-0.013245197,0.018356469,-0.014321936,0.0055750473,-0.0053934287,-0.013083037,0.023363957,0.0066744895,0.01363438,0.0421615,-0.0033275152,-0.025712028,0.015294895,-0.048933282,0.019718608,-0.028799547,0.00028073884,-0.026529312,-0.003950208,0.014179236,0.01897916,0.0069793495,-0.004388039,-0.027580107,0.0037588598,0.015139221,-0.0112149585,-0.0046183057,-0.017733775,-0.01377708,0.010572807,0.00035654844,0.009813899,0.01096199,-0.016384607,0.014192209,0.008017171,0.048466265,-0.020354275,-0.025621219,-0.01262899,-0.0072323186,-0.002091859,0.010183623,0.012966283,0.0001900308,0.012583585,-0.014218154,0.024907716,-0.008996615,-0.007829066,0.01790242,0.021236422,-0.026697958,0.006311252,-0.010812803,0.004692899,0.006901513,0.005698289,0.008166358,0.005448563,0.001866457,-0.013854917,0.0044820914,-0.0020983454,-0.024375832,0.016734872,0.001694568,0.025932565,0.017124055,0.0130311465,-0.010209569,-0.0008780943,-0.015891641,0.01117604,0.01616407,0.010936044,0.0023432064,0.017733775,-0.012706827,-0.005824773,-0.009152289,-0.0070442134,-0.015684078,0.034144327,0.0012121431,-0.01860295,0.0089706695,0.017772693,0.013854917,-0.01616407,-0.046546295,0.002521582,-0.006823676,-0.018161876,-0.02866982,-0.017227838,-0.0035675114,-0.023675302,0.034896746,0.012564126,0.037854537,-0.0073490734,0.00012050486,-1.2972769e-05,-0.017513238,0.03144599,-0.009729576,0.03500053,-0.0031248156,-0.017072164,0.0028880627,0.0024859067,0.00061134173,0.029240621,-0.0029334673,-0.0032091388,-0.033755146,-0.011707923,0.0030502223,-0.02455745,-0.01302466,-0.012635477,-0.0036161593,-0.04091611,0.0040864223,-0.005455049,-0.012583585,0.020587783,0.01340087,-0.014399773,-0.024518533,-0.011630087,0.015294895,0.06782164,-0.0027356327,0.007167455,0.007913389,-0.011111177,0.011467927,0.01799323,-0.041902043,0.012687367,-0.010916585,-0.015294895,-0.003428054,0.035363767,-0.0061847675,0.022611536,-0.002244289,-0.033132453,0.02244289,0.01785053,0.00051728915,0.018823488,-0.003183193,0.0170073,0.022403972,-0.012376022,-0.022559645,0.014308964,0.035052422,0.004436687,-0.044289034,-0.0069988086,-0.02140507,-0.014698147,0.011513332,-0.001324844,-0.025569327,-0.016138125,0.020354275,0.024726097,-0.012382507,-0.012045216,0.03645348,-0.0012632234,-0.013958699,0.0017918637,-0.004488578,-0.0057080183,0.025789864,-0.003312921,0.0010864694,0.036583208,-0.006531789,0.0066939485,0.0021129397,0.004235609,0.0038366963,-0.024077458,-0.01140955,-0.009917682,-0.012142511,-0.008613919,0.00042120958,0.005665857,-0.005231269,-0.009171748,-0.024401778,-0.012661423,-0.02778767,-0.04366634,-0.0053577535,-0.0012883581,-0.03551944,0.00735556,-0.012583585,0.011059285,0.010540375,0.017876476,-0.016060287,-8.467772e-05,0.018680787,0.012654936,0.007491774,-0.0121944025,-0.040604766,0.0016264609,0.006155579,0.012168457,0.010903612,-0.013193306,-0.0052864035,0.008821483,-0.0006980971,0.018356469,-0.002862117,0.013083037,-0.0116236005,-0.010845235,0.006327468,-0.0032010307,-0.01508733,0.027372543,-0.024207186,-0.015152194,-0.0013629515,0.008866888,-0.014568419,0.017266756,0.012025757,-0.03603835,-0.01040416,0.0028750899,-0.01817485,0.004018315,0.0037556165,0.011273336,-0.011163067,0.0040345313,0.022520727,0.0032188683,-0.026204992,0.012161971,-0.009729576,0.0037750758,0.02389584,-0.02089913,0.041824207,-0.003087519,-0.025517436,-0.010663616,-0.022339107,0.008043117,0.018447278,-0.00060769316,-0.035960514,-0.021015886,0.0069988086,-0.002111318,0.02455745,-0.023856921,0.0025475274,-0.013841944,-0.0030842759,0.011026854,0.0049523544,-0.0072517777,-0.023727193,-0.01255764,0.015632186,-0.013336007,0.0014456529,-0.021197503,0.008756619,0.004018315,-0.014192209,-0.002083751,-0.036998335,-0.023999622,0.015567322,0.027294705,0.038918305,0.00628855,-0.0065771937,0.023312066,-0.010462538,0.009755522,0.011111177,-0.005328565,-0.0030858973,-0.015359758,0.0141014,-0.0032496785,-0.014127345,0.017111082,0.04127935,0.023701249,0.018317549,0.013530598,-0.0058799074,-0.012868986,-0.01593056,0.0061912537,0.0064182775,-0.005536129,-0.022040734,-0.014231128,-0.032821104,0.040111803,0.0051923506,-0.0099501135,-0.010254974,0.0251542,-0.011221445,0.03180923,-0.025465544,0.011493873,-0.03250976,0.00398264,-0.021431014,0.0059285555,0.0007698527,0.002746984,0.0047674924,-0.00060850393,0.001469166,0.013841944,0.011513332,-0.010793343,-0.00773177,0.017175946,-0.0047285743,-0.028929275,-0.03725779,-0.021768305,-0.025413655,-0.0013799783,0.026308775,-0.022806127,0.0054615354,-0.010014977,-0.013906808,0.008724187,-0.011902516,0.03967073,0.0022394243,0.024661234,0.013141415,0.010767398,-0.013374925,0.02497258,0.007900416,0.010131733,0.030719517,0.031835176,-0.009969573,-0.02052292,0.015126248,0.0064766547,-0.032405976,-0.04021558,0.02866982,0.0008780943,0.003106978,-0.017422428,0.0033242719,-0.0021891547,0.0036842662,-0.0014245722,-0.02361044,-0.0007864741,-0.01625488,-0.0287736,0.025335817,-0.011111177,0.0013556543,-0.008866888,-0.006625842,-0.0007179617,-0.007945821,-0.021988843,0.012168457,0.005176135,-0.0025605003,-0.016384607,0.0057631526,0.011474414,-0.01756513,0.001830782,-0.011331714,-0.014075454,0.03302867,-0.01785053,0.004164259,-0.011934947,0.011675492,-0.018940242,-0.0031264373,-0.0046377648,-0.014283018,-0.0120711615,0.00017452428,0.041383132,0.016916491,-0.000810798,-0.008140412,-0.015061384,0.017720802,-0.00628855,-0.015139221,-3.8639595e-05,-0.029733585,-0.008685268,0.0064507094,-0.003376163,0.008237708,0.0046961424,-0.027476324,0.019329425,0.026075264,0.0041610156,0.019446181,-0.036894556,0.007465828,-0.03134221,-0.010540375,0.018421331,-0.023805032,0.017435402,-0.014763011,-0.045223072,-0.0014553824,0.0047869515,0.023999622,-0.027476324,0.0026594177,0.030849244,0.0066744895,0.021625606,-0.0071804277,0.003541566,0.018148903,-0.008023658,-0.007407451,0.0064571956,-0.025530409,0.007809607,-0.034170274,-0.0058669345,0.010300378,-0.032924887,-0.028099017,-0.008192304,0.030849244,-0.015100303,-0.012525208,-0.0340146,-0.020717511,-0.018239712,0.029785477,0.0015672726,-0.0050204615,0.0021210476,0.03476702,-0.004300473,0.012233321,-0.015735969,-0.023363957,0.016786763,-0.01087118,-0.038581014,-0.007173941,-0.019524017,0.034222163,-0.01004741,0.006544762,-0.030018987,0.02009482,-0.04156475,-0.018473223,0.021988843,0.019277534,0.026438503,0.0012899797,0.009191207,0.02323423,0.013556544,0.0026610391,-0.028228745,-0.02581581,-0.0023869895,0.006823676,0.021249395,0.0039437218,-0.023636384,0.0061717946,0.030252496,-0.012940337,0.0046150624,0.012914391,-0.03157572,-0.025050417,-0.029500077,0.02497258,0.0072906963,0.0075501516,0.0027032008,0.0043296614,-0.024868798,0.015165167,0.0022653698,-0.0113576595,0.0073490734,-0.00089349947,-0.013699244,0.043873902,-0.015735969,0.008652837,0.0043588504,-0.012233321,0.016293798,0.0015494351,-0.011390091,0.026775794,-0.006314495,-0.030356279,-0.014153291,0.01836944,-0.0060680127,0.009119856,0.012551154,0.001730243,0.033755146,-0.008685268,0.015904615,-0.036323752,0.009139315,0.001830782,0.005720991,-0.021638578,0.020730484,-0.0069988086,0.010060382,0.016825682,-0.005169648,0.019939145,0.003424811,-0.012388994,-0.0020415895,0.0031621123,0.013037632,0.016786763,-0.016215961,-0.0049199224,-0.016008396,-0.008120953,-0.032354087,0.008977156,0.18224145,-0.00071431306,0.026905522,0.018953215,-0.008133926,-0.005922069,0.039151818,-0.0013799783,-0.007835552,0.02351963,-0.010430106,0.018628895,-0.004190204,0.013225738,0.03227625,-0.020250492,0.0053253216,0.0058669345,-0.009294989,-0.040163692,-0.009035533,0.0026513096,-0.0034021086,-0.0013572759,0.0311087,0.00528316,-0.010339296,-0.009450662,0.0103976745,0.018551059,0.0069404314,-0.018213768,-0.022494782,0.011487387,-0.010696048,0.004268041,-0.0282028,0.02333801,0.025076361,0.01705919,0.0014870036,0.014788956,0.0012616018,0.009282016,-0.004057233,0.040163692,-0.006466925,-0.012635477,-0.020860212,0.011740356,-0.021820197,0.021716414,0.034351893,0.011221445,-0.0030080609,-0.017305674,-0.009171748,-0.007109077,-0.010689561,0.014763011,-0.0052053235,0.025750946,-0.0046442514,0.022092625,-0.026127156,0.031783283,-0.029370349,0.01302466,-0.002674012,-0.006256118,-0.016436499,-0.03948911,0.005247485,-0.006463682,0.011163067,-0.008172845,0.01227224,0.007530692,0.010371729,0.01164306,-0.00047472227,-0.012875473,-0.024323942,0.030460062,-0.012804123,-0.014775984,0.040319365,0.0055101835,0.01564516,-0.012966283,-0.019511044,-0.015541377,-3.729671e-05,-0.02272829,0.01164306,0.010488483,0.0025961753,0.022066679,-0.022313163,-0.031705447,-0.010696048,-0.006625842,0.02872171,0.015450568,-0.012012783,-0.012453858,-0.011111177,0.024726097,-0.004242095,-0.025283927,-0.0066420576,-0.020665621,0.015204085,-0.024090432,0.014218154,0.017642966,-0.0036907527,-0.0131543875,0.018330522,-0.004336148,-0.015684078,-0.007394478,0.017604047,0.004452903,-0.00887986,-0.032250304,-0.011993324,0.008056089,0.0033340016,-0.029759532,-0.00086187833,-0.02361044,0.012161971,-0.015619214,0.009567417,0.0033340016,0.010631184,-0.031238427,0.0103976745,0.0062009837,0.013880863,0.007446369,0.012116566,0.013374925,0.013141415,-0.027528215,0.015528404,0.011675492,-0.015671104,-0.019316453,-0.027216868,-0.005633425,0.016241906,-0.031316265,0.029526021,-0.00374913,-0.016916491,-0.0343,-0.002584824,-0.0050561368,-0.0064766547,-0.011772787,0.0194851,-0.016877573,-0.009197693,0.020393193,-0.16439092,-0.00895121,0.027891453,0.004501551,0.012129539,0.0046669533,0.02202776,-0.017824585,-0.0006263415,-0.00032614352,0.015230031,-0.002617256,-0.03323623,-0.021898033,0.0049004634,-0.0016994327,0.009431203,-0.0028799546,0.015074357,0.0016337581,0.039437216,-0.018330522,0.016890544,-0.00046053328,0.00644098,0.024803935,-0.002581581,-0.0016670008,0.012596559,-0.031601664,-0.014801929,0.0025005012,-0.0019248346,-0.00040175044,-0.011701438,0.003661564,0.0016734871,-0.010812803,-0.016708925,0.0046377648,0.018265659,0.0076020425,0.027917398,-0.017098108,0.008458246,0.004096152,0.005380456,-0.00077471754,0.0055815335,-0.032431923,0.0069339448,-0.038217776,0.024609342,0.0053123487,0.018654842,0.015917588,0.007945821,-0.009593363,0.0029934663,-0.022131544,-0.015528404,-0.031264372,0.008146899,-0.019627798,0.008322031,-0.005335051,-0.027424432,0.030018987,-0.01939429,-0.007783661,-0.016319742,-0.024297995,0.03411838,-0.027580107,0.0039891265,0.010287406,-0.0068625947,0.0045177666,-0.017487293,-0.007141509,-0.014775984,0.050048944,-0.017785667,0.012920878,0.027424432,0.001790242,0.004540469,-0.016644062,0.023571521,0.0013102497,0.015022466,-0.011227931,-0.022390999,0.0058993665,0.026620122,0.009262557,-0.025543382,-0.00010895099,-0.004705872,-0.01288196,0.012453858,-0.031056808,-0.012453858,0.010371729,0.017591074,0.012395481,0.006411791,0.0058604483,0.02263748,-0.0028815763,0.015048412,-0.014438692,0.017124055,0.0003391163,-0.020665621,0.0040215584,0.018927269,-0.036271863,0.032042738,-0.0008772835,0.02394773,-0.007764202,-0.01056632,-0.012304671,-0.0015243003,-0.015074357,-0.10315946,-0.0019248346,0.0076539335,0.0130311465,-0.021962898,0.019575909,0.0073815053,0.013608434,0.010683075,0.015476513,0.012226835,-0.00674584,0.0006271523,-0.010812803,0.008328518,-0.0023610438,-0.009158774,-0.010689561,-0.0073815053,-0.0065707075,0.005604236,-0.016670007,0.0055491016,-0.00848419,0.0020367247,0.034896746,-0.015761914,0.012473317,0.02708714,0.015995424,0.0029172513,-0.018538086,-0.0019248346,-0.02656823,-0.0055977497,-0.015917588,-0.009625794,-0.012350076,0.026620122,-0.0251542,-0.015372731,0.0036810231,-0.005909096,-0.042420954,-0.006732867,-0.009723091,-0.014049509,0.010741453,0.0040604766,-0.02534879,-0.0020578054,-0.010825776,-0.042524736,-0.020328328,0.040085856,-0.0074852877,0.0010394431,0.02361044,-0.008030144,0.004044261,0.0052215396,-0.001156198,0.025621219,0.030096823,0.016371634,0.005941528,-0.005584777,0.008944724,0.03256165,-0.012058188,0.007978253,0.03186112,-0.01569705,-0.008665809,-0.031056808,0.020159682,-0.008283113,-0.016734872,0.019238615,-0.009288503,-0.015761914,-0.023013692,-0.007744743,-0.0028394149,-0.0027356327,0.013997617,0.0145424735,-0.0043296614,0.006058283,-0.003693996,0.009067966,0.012187916,-0.0040345313,-0.0026529313,-0.004469119,0.0061166603,0.009087425,0.0011902516,0.015943533,0.020068873,-0.023869894,-0.021703443,-0.053344026,0.017681884,0.00019134834,-0.015126248,0.028617928,-0.013530598,0.009917682,-0.018823488,0.011720897,0.0228191,-0.041590698,0.013044119,-0.0228191,0.0145813925,-0.02052292,0.011448468,0.008944724,0.00051607296,0.033340015,0.027761726,-0.001100253,0.008451759,0.03795832,0.013128442,-0.006447466,0.02220938,-0.021469932,0.01930348,-0.020419138,0.0061134174,0.021962898,-0.028150909,-0.013284115,0.021119667,-0.008892833,-0.006243145,0.0051210006,0.024168268,-0.023805032,0.01836944,-0.011681979,-0.00013753162,3.896898e-05,-0.02131426,0.006616112,0.0013264656,-0.0050139753,0.018667813,0.012239807,-0.011240904,0.03655726,0.007530692,-0.026101211,-0.010125246,-0.016721899,-0.017500265,0.03500053,0.008380408,0.013245197,-0.022092625,0.034844857,0.0033242719,0.017500265,-0.019614827,-0.007842039,0.0067393533,-0.022313163,0.016592171,0.017837558,-0.025102308,-0.029214675,0.003914533,0.0057015317,-0.0041804747,0.014983548,-0.019991037,-0.0140105905,-0.00911337,-0.028617928,0.01433491,0.0030129256,-0.0143868,-0.016423525,-0.0007483666,0.04057882,-0.019926174,-0.014179236,0.0152559765,-0.0050918115,0.0025669867,-0.019640772,0.015735969,-0.012213862,0.008568514,-0.008458246,0.021301286,-0.0028718468,0.008030144,-0.00080714945,0.023701249,-0.00035289986,0.007018268,-0.019614827,-0.018551059,-0.023805032,-0.012434399,-0.010592266,-0.041175567,-0.019666718,0.013323033,0.010897126,-0.004057233,-0.0012916013,-0.0014059239,-0.01248629,0.032120574,-0.003411838,-0.0026691472,-0.0225337,0.005633425,0.002497258,0.0033631902,0.03969667,-0.01377708,0.0011886299,0.0037394005,0.03308056,-0.02201479,0.009995518,-0.0010426863,-0.0022572617,0.0030988702,-0.006256118,-0.018304577,-0.019044025,-0.007679879,0.019848336,0.009690658,-0.02010779,0.034689184,0.0029075218,0.0011829543,0.034559455,-0.023779085,0.019173753,0.02412935,0.03250976,-0.020159682,0.012200889,-0.00233672,-0.020691566,0.01949807,-0.014347882,-0.01827863,0.020081846,-0.0015307867,-0.01738351,0.004540469,-0.024713125,0.019199697,-0.0015591646,0.021521823,0.0013353843,-0.017941339,-0.009528499,0.0199132,-0.014062481,-0.009217152,-0.017811611,0.01227224,0.011039826,-0.034741074,-0.013880863,0.005753423,-0.023727193,0.0048485724,0.005030191,0.024207186,-0.008490677,-0.023986649,-0.020406166,-0.018914297,-0.002481042,0.00064580067,0.012466831,-0.026931468,-0.008665809,-0.02698336]

Explain this query

If you run the second (nearVector) query, you will see that it returns the same results as the nearObject query. The distances are also identical. This is because the vector of object in the nearObject query is identical to the vector you specify in the nearVector query.

nearText

If the nearText operator is used, Weaviate converts the input text to a vector to use as the input. The specific method would depend on the vectorizer applicable to the relevant class. Depending on the setting, Weaviate may use the text2vec-openai module or the text2vec-transformers module to do this.

Vectorizer setting

We will cover how to set the vectoriser in the next section.

response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2).with_near_text(
{"concepts": ["popular 90s comedy"]}
).with_additional(
["distance", "id"]
).do()

print(json.dumps(response, indent=2))
See the JSON response
{
"data": {
"Get": {
"JeopardyQuestion": [
{
"_additional": {
"distance": 0.1800943,
"id": "92710bd6-de3c-5220-a60a-d386b2748e28"
},
"answer": "Two Guys and a Girl",
"question": "In 1999 an ABC sitcom dropped \"a Pizza Place\" from its name, which changed to this"
},
{
"_additional": {
"distance": 0.18657643,
"id": "7e7a6572-02bd-529f-8943-38ccd4a2a90b"
},
"answer": "Beavis & Butthead of the Class",
"question": "2 MTV cartoon teens join Howard Heh-Heh-Hesseman's honors program on '80's TV"
}
]
}
}
}

Now, try running this nearVector query and compare the results:

response = client.query.get(
"JeopardyQuestion",
["question", "answer"]
).with_limit(2).with_near_vector(
{"vector": popular_90s_comedy_vector}
).with_additional(
["distance", "id"]
).do()

print(json.dumps(response, indent=2))
See the full `popular_90s_comedy_vector`

[0.011615951545536518,-0.041561901569366455,-0.007776559796184301,-0.017821554094552994,-0.019294733181595802,0.02404019609093666,-0.020011767745018005,-0.029985059052705765,-0.009738625958561897,-0.019777102395892143,0.011420396156609058,0.011381285265088081,0.02126331813633442,0.0006441083969548345,-0.00040923902997747064,0.003252727212384343,0.03358326479792595,-0.010207957588136196,0.012528539635241032,-0.028029512614011765,-0.002819247543811798,0.0020549544133245945,-0.01788673922419548,-0.022514868527650833,0.01934688165783882,0.009816847741603851,0.022697385400533676,-0.018251774832606316,-0.010566473938524723,-0.010149290785193443,0.01877325400710106,-0.004126205109059811,-0.00828500185161829,-0.005051830783486366,-0.019829250872135162,-0.010410030372440815,-0.016257116571068764,0.0006098863086663187,0.026621518656611443,0.007385450415313244,-0.0030881352722644806,-0.022228054702281952,-0.009340997785329819,-0.014562309719622135,-0.030480464920401573,0.006016567349433899,0.013806164264678955,-0.016739485785365105,-0.009862476959824562,0.009706033393740654,0.018121404573321342,-0.012671946547925472,-0.018434293568134308,-0.014979492872953415,0.01627015322446823,0.007848263718187809,-0.0029773209244012833,-0.004012131132185459,0.01617889478802681,-0.0035590962506830692,-0.01808229461312294,-0.010951065458357334,-0.022175906226038933,0.019868360832333565,-0.014275495894253254,0.026308629661798477,0.012763205915689468,-0.017169706523418427,0.01797799952328205,-0.012104838155210018,0.02184998244047165,0.001570956315845251,0.003663392039015889,0.01199402380734682,-0.00033468377660028636,-0.017182743176817894,-0.002327101305127144,0.012163504958152771,-0.01229387428611517,0.00793952215462923,0.033557191491127014,-0.02727336622774601,0.001487845554947853,-0.0004795165150426328,0.010455659590661526,-0.0013110315194353461,-0.020024804398417473,0.02434004656970501,-0.016987187787890434,-0.008154632523655891,0.00921062845736742,0.019073104485869408,0.04265700653195381,0.018786290660500526,-0.01969888061285019,0.02829025126993656,-0.011915802024304867,0.012052690610289574,0.006078492850065231,-0.008910777047276497,0.01067728828638792,-0.007672264240682125,-0.02985468879342079,-0.02032465487718582,0.02174568735063076,-0.007561449892818928,-0.006088270805776119,0.010553437285125256,0.014523197896778584,0.011902764439582825,-0.0010103661334142089,0.024300934746861458,0.016635188832879066,-0.034965187311172485,-0.0123916519805789,-0.01603548787534237,0.018681995570659637,-0.00523108895868063,-0.02810773439705372,-0.02727336622774601,0.011818024329841137,-0.003754650941118598,0.035851702094078064,-0.005879679229110479,0.02834239974617958,0.006049159914255142,-0.01842125691473484,-0.024613821879029274,0.013362906873226166,0.011055361479520798,0.042500562965869904,-0.012228689156472683,0.024744192138314247,-0.00845448300242424,-0.03801583871245384,0.01804318279027939,-0.0005760716740041971,0.018238738179206848,-0.011661580763757229,-0.01119224913418293,0.019490288570523262,0.04466470330953598,-0.015696527436375618,-0.004611832555383444,-0.011166175827383995,0.017560815438628197,0.019516361877322197,0.005459236446768045,0.00791996717453003,-0.004644425120204687,0.027351589873433113,-0.0021250280551612377,0.00931492354720831,0.02199338935315609,-0.01035788282752037,0.01852555200457573,-0.00765922712162137,0.008949887938797474,-0.01954243704676628,-0.020311618223786354,0.002983839251101017,0.011022768914699554,0.027586255222558975,-0.022319313138723373,-0.028811730444431305,0.02364908531308174,0.044299665838479996,0.007985151372849941,0.006094789132475853,-0.010755510069429874,0.012502466328442097,0.020063916221261024,-0.043569594621658325,0.017808517441153526,0.0009932550601661205,0.016922002658247948,-0.018316959962248802,0.015096825547516346,-0.0012108096852898598,-0.004862794186919928,0.019033994525671005,0.02149798348546028,0.01464053150266409,0.04393463209271431,-0.014431939460337162,0.011446470394730568,0.013291203416883945,-0.023636048659682274,-0.007913447916507721,-0.007809152361005545,0.020168211311101913,0.025917520746588707,0.008637000806629658,-0.025813225656747818,-0.6378734707832336,-0.014353717677295208,-0.006000271067023277,-0.0254221148788929,0.025630706921219826,-0.000653071328997612,-0.013949571177363396,-0.006593453697860241,-0.01813444308936596,-0.009490923024713993,0.006208862643688917,0.011270470917224884,0.030324021354317665,-0.0015571045223623514,-0.022997237741947174,-0.011094472371041775,0.02169353887438774,-0.011244397610425949,0.0050779045559465885,-0.007326784078031778,-0.03029794618487358,0.016061563044786453,-0.0065804170444607735,-0.017678147181868553,0.021758724004030228,0.02439219318330288,0.015852971002459526,-0.018121404573321342,-0.008734778501093388,0.0032282827887684107,-0.025200486183166504,0.04409107565879822,-0.01295224204659462,-0.0017583629814907908,0.0620560348033905,-0.004879090469330549,-0.009080258198082447,0.031888458877801895,0.004005612805485725,0.03402652218937874,-0.010866324417293072,-0.009093294851481915,-0.0010959213832393289,0.0012735502095893025,0.0009679959621280432,0.0068183415569365025,0.0057493094354867935,-0.005625457968562841,-0.009471368044614792,-0.014992529526352882,0.028811730444431305,0.005648272577673197,0.019998731091618538,0.002716581104323268,0.011974467895925045,0.0035982071422040462,0.012593724764883518,0.0030946535989642143,0.01316735241562128,0.0011545877205207944,-0.003885020734742284,0.015096825547516346,-0.015996377915143967,0.0022065092343837023,-0.005462495610117912,0.022462720051407814,0.015474897809326649,0.006968267261981964,0.02018124796450138,-0.030584760010242462,0.01046217791736126,0.006384862121194601,-0.0280555859208107,0.0009606626117601991,-0.007835226133465767,0.014927344396710396,0.013310759328305721,-0.0005911456537432969,-0.00889774039387703,0.018264811486005783,0.007535375654697418,0.006146937143057585,-0.015227195806801319,-0.006309899501502514,0.02888995222747326,-0.01817355304956436,-0.01475786417722702,0.014405865222215652,0.01808229461312294,0.0027882845606654882,0.02082006074488163,0.0020859171636402607,-0.017274001613259315,-0.027820920571684837,-0.0026008780114352703,-0.018590737134218216,-0.026751887053251266,0.010123216547071934,0.033948302268981934,-0.04443003609776497,0.028081659227609634,-0.02302331104874611,0.02263220213353634,-0.001355031388811767,-0.018004072830080986,0.012372096069157124,0.0030995425768196583,0.027638401836156845,0.02145887352526188,-0.009803811088204384,0.012847946025431156,-0.012763205915689468,-0.008337150327861309,-0.044690776616334915,-0.005928567610681057,-0.019281696528196335,0.010305734351277351,0.02003784105181694,0.010996694676578045,-0.000906070286873728,0.00887166615575552,-0.036868587136268616,-0.014875196851789951,0.007548412773758173,-0.006401158403605223,0.014471050351858139,0.019047031179070473,0.008187225088477135,-0.009797291830182076,-0.0036959846038371325,-0.006544565316289663,0.004536869935691357,0.022905977442860603,-0.005478791892528534,-0.010031958110630512,0.030271872878074646,0.010488252155482769,-0.02823810465633869,0.002866506576538086,-0.008610926568508148,-0.0014226606581360102,-0.005309311207383871,-0.021758724004030228,-0.007053007371723652,-0.0036731697618961334,-0.03358326479792595,0.008304557763040066,0.006225158926099539,-0.018356071785092354,-0.0018724366091191769,-0.01014277245849371,-0.012639353983104229,-0.006665157154202461,-0.00048807202256284654,0.01018840167671442,-0.009999365545809269,-0.006837897468358278,-0.022449683398008347,-0.004536869935691357,-0.015566157177090645,0.02144583687186241,0.01573563739657402,-0.021145984530448914,-0.0022423609625548124,0.01744348183274269,-0.008056854829192162,-0.009275812655687332,0.016922002658247948,-0.013219499960541725,-0.018395181745290756,0.007346339523792267,0.011818024329841137,-0.00828500185161829,0.0021625093650072813,-0.007952558808028698,0.0424223393201828,0.008213299326598644,-0.013428092002868652,0.023922862485051155,-0.0058210124261677265,0.0014259199379011989,-0.015018603764474392,-0.020311618223786354,-0.026021817699074745,0.03629495948553085,-0.025682855397462845,0.033348601311445236,0.02169353887438774,-0.020780950784683228,0.008102484978735447,-0.009295368567109108,0.014810011722147465,-0.01799103617668152,-0.03402652218937874,0.01730007492005825,-0.01651785708963871,0.02149798348546028,0.016061563044786453,0.026360778138041496,0.004680276848375797,0.018095331266522408,-0.003523244522511959,0.01681770756840706,-0.020455025136470795,0.014275495894253254,-0.032566383481025696,-0.006759675219655037,-0.03778117522597313,0.0037742063868790865,0.030324021354317665,0.007652708794921637,0.014705715700984001,0.0021543612238019705,-0.02072880230844021,-0.004611832555383444,0.028550991788506508,-0.03230564296245575,0.027038700878620148,-0.01434068102389574,-0.0051561263389885426,-0.02014213800430298,-0.015722600743174553,0.022215018048882484,0.017365260049700737,0.0008555519743822515,0.013519350439310074,-0.005403829272836447,-0.016882892698049545,-0.003640577429905534,-0.023244939744472504,-0.004748720675706863,0.027090849354863167,0.0045401290990412235,0.039997462183237076,-0.0019180660601705313,-0.03812013566493988,0.021771760657429695,-0.012750168330967426,0.03001113422214985,-0.0055374582298099995,-0.023766418918967247,0.024548638612031937,0.012274319306015968,-0.011498618870973587,0.008474038913846016,-0.0012678465573117137,0.012658909894526005,0.002385767875239253,-0.009047665633261204,0.022905977442860603,-0.01735222339630127,-0.017730295658111572,-0.002615544479340315,0.005866642110049725,0.018551625311374664,-0.0225279051810503,0.028863878920674324,-0.002630211180076003,0.010423067025840282,0.03251423314213753,-0.007522339001297951,-0.03274890035390854,0.020833097398281097,-0.010194920003414154,0.0028599880170077085,1.3049713743384928e-05,-0.0012458466226235032,-0.022358424961566925,-0.03113231435418129,0.019868360832333565,-0.006681453436613083,-0.022658275440335274,0.004276130348443985,-0.014119052328169346,-0.004898645915091038,-0.0029463579412549734,-0.04059716314077377,0.03522592782974243,-0.01473178993910551,-0.017091484740376472,-0.01563134230673313,-0.044795069843530655,0.02512226440012455,0.0069030821323394775,-0.007854782044887543,-0.00035607258905656636,-0.001487845554947853,-0.020246433094143867,-0.00619582599028945,0.01832999661564827,-0.020207323133945465,0.019333845004439354,-0.02101561613380909,0.0261000394821167,-0.0031712460331618786,0.003614503424614668,0.01563134230673313,0.0031924310605973005,0.007215969730168581,0.005446199327707291,-1.573604458826594e-05,0.008363224565982819,-0.04135330766439438,-0.03420904278755188,0.013375943526625633,-0.015970302745699883,-0.005279977805912495,-0.028577065095305443,0.0039045761805027723,-0.00017212890088558197,0.00024444342125207186,-0.005211533512920141,-0.02800343744456768,0.007933003827929497,-0.018004072830080986,-0.005586347077041864,-0.006671675946563482,-0.016504820436239243,0.018238738179206848,-0.020194286480545998,0.0011171064106747508,-0.03199275583028793,-0.023049384355545044,-0.0031223571859300137,0.11921016871929169,0.008304557763040066,0.02507011778652668,0.0156443789601326,-0.015566157177090645,-0.01754777878522873,-0.015540082938969135,0.0002884432324208319,0.014158163219690323,-0.008337150327861309,0.03175808861851692,-0.005899234674870968,0.01975102908909321,-0.006909600459039211,0.011720247566699982,0.005625457968562841,-0.009829884395003319,0.002861617598682642,0.03108016587793827,-0.013714905828237534,-0.028264177963137627,-0.0026790997944772243,0.0072355251759290695,0.014418902806937695,0.0024395452346652746,-0.03577347844839096,0.019033994525671005,0.031106239184737206,0.018538588657975197,-0.01935991831123829,-0.03337467461824417,0.008434928022325039,-0.021628353744745255,0.002825765870511532,0.03689466044306755,0.00887166615575552,0.016152821481227875,-0.0015913266688585281,0.018199628219008446,-0.008617444895207882,0.015109862200915813,0.0030213205609470606,0.007985151372849941,-0.019138289615511894,0.025278707966208458,-0.027742698788642883,-0.012007060460746288,0.027142997831106186,0.004618350882083178,-0.021380651742219925,0.03342682123184204,-0.010058032348752022,-0.013962607830762863,0.02111991122364998,0.01774333231151104,0.004918201360851526,-0.008226335979998112,-0.013245574198663235,-0.026230407878756523,0.007887374609708786,-0.008441446349024773,-0.020415915176272392,0.025474263355135918,-0.004357611294835806,-0.01084676943719387,-0.02394893579185009,-0.003927391022443771,-0.0007162191905081272,-0.0016817707801237702,-0.012932686135172844,-0.014796975068747997,-0.01131610106676817,-0.021145984530448914,0.021667465567588806,0.011648544110357761,-0.004087093751877546,0.013649720698595047,-0.005543976556509733,-0.00789389293640852,0.012756687588989735,-0.002947987522929907,-0.01969888061285019,-0.003251097397878766,-0.04575980827212334,0.011466026306152344,0.010396993719041348,0.00845448300242424,0.00018628625548444688,-0.029098544269800186,0.0032722826581448317,0.03240993991494179,-0.005710198078304529,-0.007887374609708786,0.015657415613532066,0.005983974784612656,-0.004315241239964962,0.0359559990465641,0.03327037766575813,0.027351589873433113,0.003950205631554127,-0.0009557737503200769,-0.03895450383424759,-0.007691819686442614,0.0019962878432124853,-0.03214919939637184,-0.006844415795058012,-0.00896944385021925,0.0248224139213562,-0.019633695483207703,-0.0016271783970296383,0.028994249179959297,0.008832555264234543,0.005035534501075745,-0.01170720998197794,0.021132947877049446,0.030167577788233757,-0.001693178084678948,0.034287262707948685,-0.023049384355545044,0.008813000284135342,0.016974151134490967,-0.04080575332045555,0.016530893743038177,0.017143631353974342,-0.0006881082081235945,-0.0005108867189846933,0.014679642394185066,-0.03274890035390854,-0.0017029558075591922,-0.00023690641683060676,-0.0034059116151183844,0.04091005027294159,-0.0018919920548796654,-0.026856184005737305,-0.03475659340620041,-0.010931509546935558,0.01375401671975851,0.02238449826836586,0.00921062845736742,-0.034287262707948685,-0.04466470330953598,0.012372096069157124,0.015657415613532066,-0.009471368044614792,-0.0029105062130838633,-0.018264811486005783,-0.004830202087759972,-0.02359693869948387,0.003614503424614668,0.00557330995798111,-0.013832238502800465,0.004210945218801498,0.005658050533384085,0.0009492552489973605,-0.010527363047003746,-0.03598207235336304,-0.0010478474432602525,-0.002965913387015462,0.005658050533384085,0.02003784105181694,0.01817355304956436,-0.008767371065914631,0.01053388137370348,-0.005335384979844093,0.013871349394321442,-0.000724367331713438,0.001041329000145197,-0.008760851807892323,-0.013089130632579327,0.012919649481773376,0.012737131677567959,-0.008219817653298378,-0.006290344055742025,0.03924131765961647,-0.01329772174358368,0.010390475392341614,0.011172694154083729,-0.008839073590934277,-0.00872825924307108,-0.022371461614966393,0.004184871446341276,-0.006877008359879255,-0.015266306698322296,0.00654782447963953,-0.0010665880981832743,0.0034776150714606047,0.01084676943719387,0.022201981395483017,-0.012671946547925472,0.008910777047276497,0.03287927061319351,0.007222488056868315,0.023244939744472504,0.008161150850355625,-0.012730613350868225,-0.01114661991596222,-0.018786290660500526,-0.0038524281699210405,-0.001970214070752263,0.006202344316989183,0.017912814393639565,0.02091131918132305,0.0018414737423881888,0.007998188957571983,0.007092118263244629,0.038094062358140945,-0.014575346373021603,-0.05141785740852356,-0.006798786111176014,-0.0205723587423563,-0.01959458366036415,-0.03645140305161476,-0.013597572222352028,-0.03822443261742592,0.008780407719314098,0.00033325786353088915,0.016087636351585388,0.0109445471316576,0.0036568734794855118,0.005977456457912922,-0.0024411750491708517,-0.010696844197809696,0.01911221630871296,0.007372413296252489,0.034182969480752945,-0.011127064004540443,-0.025057079270482063,-0.005051830783486366,0.016348375007510185,-0.004611832555383444,0.011309581808745861,0.0041229454800486565,0.022736497223377228,0.028577065095305443,-0.005850345827639103,0.012632835656404495,-0.017873702570796013,-0.03436548635363579,-0.04208337888121605,0.029385358095169067,0.003907835576683283,-0.0011228100629523396,-0.027977364137768745,-0.01587904430925846,-0.008298039436340332,0.013454166240990162,0.010735955089330673,-0.0018561403267085552,0.008584853261709213,-0.005563532002270222,-0.0027442846912890673,0.01920347474515438,-0.003119098022580147,-0.017078446224331856,-0.032383862882852554,-0.008082929067313671,0.0054559772834181786,-0.025787150487303734,0.003233171533793211,0.018994882702827454,-0.006632564589381218,0.028655286878347397,-0.004510795697569847,-0.002770358696579933,0.011459507048130035,-0.0005630346713587642,-0.010690325871109962,0.014744826592504978,0.008461001329123974,0.02267131209373474,0.007346339523792267,0.0010649585165083408,0.008447964675724506,-0.016504820436239243,0.032227419316768646,-0.007854782044887543,0.001358290552161634,-0.03371363505721092,-0.004699832294136286,-0.002092435723170638,0.022788645699620247,0.012593724764883518,-0.002015843288972974,0.018734144046902657,-0.004514055326581001,0.03063690848648548,-0.021915167570114136,-0.034678373485803604,-0.004145760554820299,-0.018981846049427986,-0.0012523650657385588,-0.005638495087623596,0.021471910178661346,-0.0011716987937688828,0.0038263543974608183,-0.002449322957545519,0.016100673004984856,-0.006567379925400019,-0.010247068479657173,0.005847086664289236,-0.01612674631178379,0.018316959962248802,-0.006877008359879255,0.008148114196956158,0.007496264763176441,-0.03152342513203621,0.0384330227971077,0.003979539033025503,-0.008519668132066727,-0.014705715700984001,-0.0016703633591532707,-0.0019816213753074408,-0.0012784390710294247,-0.010566473938524723,0.012958760373294353,0.03152342513203621,-0.009477886371314526,-0.04456040635704994,-0.02092435583472252,0.032331716269254684,-0.01133565604686737,0.013532388024032116,0.013336832635104656,0.016452671959996223,0.02570892870426178,-0.011537729762494564,-0.0022276942618191242,0.000284980284050107,-0.02458774857223034,-0.010696844197809696,-0.00967344082891941,0.01993354596197605,0.023779455572366714,-0.021823909133672714,-0.023766418918967247,-0.0031451720278710127,-0.003624281147494912,0.043230634182691574,-0.0015155491419136524,0.04171834513545036,0.001864288467913866,0.05376451462507248,-0.004386944696307182,0.03650354966521263,-0.0003338689566589892,-0.03040224313735962,-0.0006962563493289053,-0.015435786917805672,0.002428137930110097,0.011511655524373055,0.004253315273672342,0.019020957872271538,0.0035427999682724476,-0.01647874526679516,-0.0312887579202652,-0.014458013698458672,-0.024887599050998688,-0.013082611374557018,-0.018747180700302124,0.015096825547516346,0.032175272703170776,0.006189307197928429,-0.004149019718170166,-0.012215652503073215,0.007906929589807987,0.016283191740512848,-0.03676429018378258,0.008043818175792694,0.010025439783930779,0.0159833412617445,0.012828391045331955,-0.001454438315704465,0.012117874808609486,-0.011863653548061848,0.03147127479314804,0.015396676026284695,0.00791996717453003,0.004699832294136286,-0.009803811088204384,-0.0016752522205933928,-0.01464053150266409,0.0011032546171918511,-0.005423384718596935,-0.006759675219655037,0.0030865054577589035,-0.02355782687664032,-0.0004734054091386497,-0.020207323133945465,0.010207957588136196,-0.00012823093857150525,-0.0010486622340977192,0.01194839458912611,0.02423574961721897,0.00786781869828701,0.011889727786183357,-0.01503164041787386,-0.025721965357661247,-0.003627540310844779,-0.0006730342283844948,-0.011531210504472256,0.004126205109059811,0.010742473416030407,-0.0052506448701024055,-0.012482910417020321,-0.0024916932452470064,-0.012313430197536945,-0.0008058484527282417,-0.02649114839732647,0.014823049306869507,-0.014327643439173698,0.0020631025545299053,-0.010924991220235825,0.02888995222747326,-0.034965187311172485,0.0060817524790763855,0.005407088436186314,0.0011912542395293713,-0.013727942481637001,0.006463083904236555,0.017912814393639565,-0.005804716609418392,0.013375943526625633,0.0037122806534171104,0.003225023625418544,-0.014523197896778584,-0.010807658545672894,-0.0026236926205456257,-0.037598658353090286,-0.010866324417293072,-0.004592277109622955,-0.010827213525772095,-0.011074916459619999,-0.003937168512493372,0.0018414737423881888,-0.00284043257124722,0.018160516396164894,0.2244446873664856,-0.004338055849075317,-0.009217146784067154,0.03201882913708687,0.014927344396710396,0.017026299610733986,0.008858629502356052,0.008702185936272144,0.014875196851789951,0.022984199225902557,-0.030715130269527435,0.011413877829909325,-0.011231360025703907,0.0019245845032855868,-0.008369742892682552,-0.013558461330831051,-0.019829250872135162,-0.03293141722679138,-0.04372603818774223,-0.027012627571821213,0.003549318527802825,-0.0012042912421748042,-0.018290886655449867,-0.004279389511793852,0.015292380005121231,0.014875196851789951,-0.007039970252662897,-0.020989540964365005,0.027690550312399864,0.02761232852935791,0.0012898464919999242,-0.024509526789188385,0.007600560784339905,-0.004100130870938301,-0.014653568156063557,-0.005589606240391731,-0.01578778587281704,-0.025187449529767036,-0.0036438365932554007,0.009008554741740227,-0.006270788609981537,-0.003588429419323802,0.016348375007510185,-0.01278276089578867,-0.004386944696307182,0.008819518610835075,0.008975962176918983,0.019073104485869408,-0.008878185413777828,0.018264811486005783,-0.012033134698867798,-0.00619582599028945,0.016087636351585388,0.045081883668899536,-0.0114334337413311,-0.0028078400064259768,0.016152821481227875,-0.0070790816098451614,-0.02967217192053795,0.014940381981432438,0.019959619268774986,0.03908487409353256,-0.021576205268502235,0.003591688582673669,0.0017991035711020231,0.016687337309122086,-0.031497348099946976,-0.0014055497013032436,0.010507808066904545,-0.011589877307415009,0.007365894969552755,-0.0036568734794855118,-0.02766447700560093,0.002648137044161558,-0.0053712367080152035,-0.02727336622774601,0.02844669483602047,0.0280555859208107,-0.002059843158349395,0.022462720051407814,-0.015396676026284695,-0.00175021484028548,-0.012143949046730995,0.017274001613259315,-0.025787150487303734,-0.0248224139213562,0.014092978090047836,-0.0024444342125207186,-0.003114209044724703,-0.008402335457503796,0.0060752336867153645,-0.02946357987821102,0.005873160436749458,0.012332985177636147,0.016152821481227875,0.023440495133399963,-0.02677796222269535,0.019764065742492676,-0.010553437285125256,0.005397310480475426,-0.030141502618789673,-0.03433941304683685,0.021250281482934952,-0.02810773439705372,-0.009692996740341187,-0.02316671796143055,0.009354034438729286,0.015748674049973488,0.014092978090047836,-0.003692725207656622,-0.006071974523365498,-0.017678147181868553,0.011648544110357761,0.012548095546662807,0.01715666800737381,0.01920347474515438,0.008975962176918983,-0.010273141786456108,-0.002178805647417903,-0.027846993878483772,-0.03134090453386307,-0.030949795618653297,0.0030571722891181707,0.009719070047140121,-0.016948077827692032,0.005006201099604368,-0.007724412251263857,0.015005567111074924,-0.007131229154765606,-0.016113709658384323,0.018264811486005783,0.0017404371174052358,-0.0005227015353739262,-0.012678464874625206,0.0020076953805983067,0.014692679047584534,0.01063165906816721,-0.013988682068884373,-0.012235207483172417,-0.006837897468358278,0.005234348587691784,0.0029219137504696846,-0.016674300655722618,-0.008187225088477135,0.0024786563590168953,-0.04521225392818451,0.005628717131912708,0.00019402695761527866,0.005899234674870968,7.363857730524614e-05,-0.008930332958698273,-0.016987187787890434,-0.004527091979980469,0.010625140741467476,0.005162645131349564,-0.047871798276901245,-0.018434293568134308,-0.032383862882852554,-0.014275495894253254,0.04315241053700447,-0.01969888061285019,0.007750486023724079,0.016113709658384323,6.951359682716429e-05,-0.02184998244047165,-0.005527680739760399,-0.1651003509759903,0.02165442705154419,0.005504865664988756,-0.019333845004439354,0.008369742892682552,-0.00133466103579849,0.014810011722147465,-0.0008274409919977188,0.0036470957566052675,-0.007111673709005117,0.0032902085222303867,0.011250915937125683,-0.031210536137223244,-0.021589241921901703,0.007509301882237196,-0.00026888775755651295,-0.014079940505325794,-2.4332941848115297e-06,-0.01119224913418293,0.007574486546218395,-0.0026188038755208254,0.015292380005121231,0.022371461614966393,0.012593724764883518,0.013636683113873005,0.016987187787890434,-0.003940428141504526,0.027742698788642883,-0.011576840654015541,0.00325598637573421,-0.011322619393467903,-0.03314000740647316,0.017026299610733986,0.009764700196683407,0.026034854352474213,0.004162056837230921,0.0009565885993652046,0.0018170294351875782,-0.0005198496510274708,-0.003933909349143505,0.019620658829808235,0.027846993878483772,0.01548793539404869,-0.007300710305571556,-0.0042467969469726086,0.033296454697847366,0.01877325400710106,-0.01226780004799366,0.0039045761805027723,-0.00477805407717824,-0.005599383730441332,-0.027403736487030983,0.04184871166944504,-0.0074506355449557304,0.0038263543974608183,0.008741296827793121,-0.012737131677567959,0.0248224139213562,0.008350186981260777,-0.01657000370323658,-0.005553754512220621,-0.023675160482525826,0.009158479981124401,-0.019568510353565216,-0.023101532831788063,-0.030897649005055428,-0.039945315569639206,0.0041685751639306545,-0.00957566313445568,0.0028730249032378197,-0.01187669113278389,-0.020793987438082695,0.016869856044650078,-0.030376167967915535,0.02888995222747326,0.0017534741200506687,-0.03632103279232979,0.028212029486894608,0.013402017764747143,0.012522021308541298,0.015970302745699883,0.04784572497010231,0.006049159914255142,0.016309265047311783,0.007209451403468847,0.009327961131930351,-0.008936851285398006,-0.002477026544511318,-0.014158163219690323,-0.015579193830490112,0.0021478428971022367,-0.019920509308576584,-0.0039013170171529055,-0.009745144285261631,-0.014405865222215652,0.024639897048473358,0.006498935632407665,0.030819425359368324,0.016309265047311783,-0.01444497611373663,-0.01299787126481533,-0.010755510069429874,-0.015096825547516346,0.02263220213353634,0.020050879567861557,0.014119052328169346,0.015722600743174553,0.007144266273826361,0.0029512469191104174,-0.011074916459619999,0.009966772980988026,-0.0064467876218259335,0.010540400631725788,0.011407359503209591,-0.00011865690612467006,0.002752432832494378,0.020259469747543335,-0.012287355959415436,0.0009500700980424881,-0.0012637724867090583,0.05222615227103233,0.0004167760198470205,-0.030871573835611343,-0.02268434874713421,0.006759675219655037,-0.005814494099467993,-0.07816974818706512,-0.0018268071580678225,0.005237607751041651,0.030506538227200508,-0.012743650004267693,0.041327234357595444,0.004406500142067671,0.023349234834313393,-0.027377663180232048,0.04500366374850273,-0.00960173737257719,-0.025630706921219826,-0.005511384457349777,-0.02473115548491478,0.020311618223786354,-0.01647874526679516,-0.02053324691951275,-0.026308629661798477,-0.013988682068884373,0.01671341061592102,0.0067857494577765465,-0.003286949126049876,-0.009745144285261631,-0.006368565838783979,-0.04422144591808319,-0.02126331813633442,-0.019959619268774986,0.027064776048064232,0.009764700196683407,0.002232583239674568,0.0004811461258213967,-0.019086143001914024,0.0014601419679820538,-0.02585233561694622,-0.002486804500222206,0.01876021735370159,-0.017221853137016296,-0.010370919480919838,0.01112054567784071,-0.044247519224882126,0.007255080621689558,0.018551625311374664,-0.0006151826237328351,-0.023636048659682274,0.0008987369947135448,-0.03832872956991196,-0.01065773330628872,0.013193425722420216,0.007326784078031778,-0.004266352392733097,-0.020611468702554703,-0.0018789550522342324,-0.021863019093871117,-0.00502249738201499,0.013141278177499771,-0.012378614395856857,0.03822443261742592,-0.007385450415313244,-0.0016736226389184594,-0.007202932611107826,-0.006606490816920996,-0.006599972490221262,-0.013949571177363396,0.02668670378625393,0.0052506448701024055,-0.03191453218460083,-0.009855958633124828,-0.02111991122364998,0.005227829795330763,-0.02933320961892605,-0.015813859179615974,0.010129734873771667,-0.033113934099674225,0.003198949620127678,0.012130912393331528,0.006626046262681484,0.0005447014118544757,-0.000984292128123343,0.02370123378932476,-0.0261391494423151,-0.012319948524236679,-0.021054726094007492,-0.01847340352833271,-0.01478393841534853,0.026073964312672615,0.018825402483344078,0.01866895891726017,-0.010983658023178577,-0.0016377709107473493,-0.023779455572366714,0.01975102908909321,0.02815988101065159,0.011798469349741936,0.014601420611143112,-0.009288850240409374,-0.0011179212015122175,-0.012482910417020321,-0.007737448904663324,0.022371461614966393,0.02282775565981865,-0.011909283697605133,-0.005478791892528534,-0.0751451626420021,0.004823683295398951,0.02131546661257744,-0.010025439783930779,0.010031958110630512,-0.034182969480752945,-0.0036959846038371325,-0.012724095024168491,0.025057079270482063,-0.007300710305571556,-0.031549498438835144,0.0192556232213974,-0.010344845242798328,0.0028730249032378197,-0.019242586567997932,-0.01559223048388958,0.00758752366527915,-0.00280458084307611,0.018681995570659637,0.004210945218801498,0.02096346765756607,0.002835543593391776,0.002139694755896926,0.0280555859208107,0.006890045013278723,-0.0032266532070934772,-0.00779611524194479,0.02590448409318924,-0.009979809634387493,-0.016596078872680664,0.025721965357661247,-0.029489653185009956,-0.009543071500957012,0.014914307743310928,0.019724953919649124,-0.023127606138586998,-0.023349234834313393,0.018838439136743546,0.010566473938524723,-0.006714046001434326,-0.02012910135090351,-0.017730295658111572,0.03592992201447487,-0.030324021354317665,-0.006156715098768473,-0.011961431242525578,-0.024861525744199753,0.009471368044614792,0.021589241921901703,-0.02076791226863861,0.01881236582994461,-0.0036470957566052675,-0.028029512614011765,-0.014810011722147465,-0.01302394550293684,-0.012991352938115597,0.003627540310844779,0.021954277530312538,-0.0036862066481262445,-0.012717576697468758,0.03074120357632637,0.01671341061592102,0.013102167285978794,-0.0014055497013032436,0.00045996104017831385,-0.01715666800737381,-0.018851475790143013,-0.00034690595930442214,0.008441446349024773,-0.025278707966208458,-0.010781584307551384,0.0015880673890933394,0.01514897309243679,0.03645140305161476,0.003461318789049983,-0.007672264240682125,-0.014510161243379116,-0.002375989919528365,-0.016439635306596756,0.005055089946836233,0.025539448484778404,0.0074506355449557304,-0.021915167570114136,0.03175808861851692,0.0170002244412899,0.03793761879205704,-0.027012627571821213,-0.017873702570796013,0.0034939113538712263,0.008734778501093388,-0.0069291559047997,-0.005087682511657476,0.018486440181732178,-0.0026367297396063805,0.01285446435213089,0.02800343744456768,-0.02101561613380909,0.009158479981124401,-0.0007418858003802598,0.004344574175775051,-0.0028713953215628862,-0.013845275156199932,-0.028707435354590416,-0.00852618645876646,0.0076070791110396385,0.005159385967999697,-0.008741296827793121,-0.0029545060824602842,-0.019659768790006638,0.012261281721293926,0.009367072023451328,-0.0056156800128519535,-0.0074897464364767075,0.0257610771805048,-0.004765016958117485,0.010853287763893604,-0.012078763917088509,-0.02238449826836586,-0.0047845724038779736,-0.010807658545672894,0.02085917256772518,-0.00658367620781064,0.04197908192873001,-8.484223508276045e-05,0.01808229461312294,0.027925215661525726,0.002375989919528365,-0.016869856044650078,0.0019278437830507755,-0.006127381697297096,-0.003298356430605054,-0.014353717677295208,-0.022006426006555557,0.0035427999682724476,0.029307136312127113,-0.016087636351585388,-0.004279389511793852,0.05616331845521927,-0.02400108426809311,0.06210818514227867,0.0059937527403235435,-0.01173328422009945,0.0053223478607833385,-0.005935086403042078,0.019320808351039886,-0.002861617598682642,-0.006961748469620943,-0.01063165906816721,-0.008180706761777401,-0.002651396207511425,-0.011818024329841137,0.009908106178045273,-0.0004110723384656012,0.019920509308576584,-0.005002941936254501,-0.003303245408460498,0.001389253418892622,0.014392828568816185,-0.014862160198390484,0.012652391567826271,-0.009217146784067154,0.019633695483207703,-0.008115521632134914,-0.0043836855329573154,-0.01520112156867981,0.011831061914563179,-0.012352541089057922,-0.021641390398144722,-0.033348601311445236,0.006065456196665764,-0.03259245678782463,-0.002398804761469364,-0.014418902806937695,0.01939903013408184,-0.0234665684401989,-0.009679959155619144,-0.006714046001434326,0.001711103948764503,0.016348375007510185,-0.005882938392460346,0.008669593371450901,-0.014314606785774231,-0.02380552887916565,0.0397888720035553,0.00478783156722784,0.003950205631554127,-0.008298039436340332,-0.020063916221261024]

Explain this query

When you run the second (nearVector) query, once again the query returns the same objects as the nearText query as well as distances.

In this case, Weaviate vectorizes the input text using the text2vec-openai module, which relies on the OpenAI inference API to convert the input to a vector. The vectorization process is deterministic, meaning that the same input text will always result in the same vector. For the nearVector query, we generated the vector directly using the OpenAI API and used it as the input vector, leading to the same results.

Filtering

Filters can be applied during the vector search process to further refine the results.

Under the hood, Weaviate implements "pre-filtering". This means that Weaviate applies the filter on the entire database to end up with an "allow list", from which vector search results are returned.

This, combined with efficient filtering methods, allows Weaviate to easily return the right number of results even under challenging conditions, such as when restrictive filters are applied to a large database.

The conceptual diagram below shows how the vector search process works. When an input is provided containing filters and search operators, Weaviate first performs a pre-filtering step to obtain an "allow list" of objects.

The input is used to determine an input vector, which may involve an additional step, such as retrieving the object's vector with nearObject or vectorizing the input text with nearText. The input vector is then compared to perform a vector search, returning the most relevant objects from the allow list.

Conceptual diagram of how search works

Review

Review exercise

  • Replicate a nearObject query with a nearVector query.
  • Replicate a nearText query with a nearVector query.

Key takeaways

  • nearObject operator retrieves the associated vector for an object, while nearText converts input text to a vector based on a specified vectorizer.
  • You have seen how to create equivalent nearVector queries to nearObject or nearText queries.
  • Weaviate uses "pre-filtering", meaning that filters are applied on the entire database prior to performing vector search.

Questions and feedback

If you have any questions or feedback, please let us know on our forum. For example, you can: