.vectors.upsert algorithm - Neptune Analytics
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

.vectors.upsert algorithm

The .vectors.upsert algorithm is used to add a new embedding or update an existing one for a node.

Important

Updates to vector embeddings are not ACID compliant. For details and best practices to minimize inconsistencies, see Vector index transaction support.

.vectors.upsert  syntax

CALL neptune.algo.vectors.upsert( "a target node (required)", [the embedding to upsert for the target node (required)] ) YIELD node, embedding, success RETURN node, embedding, success

.vectors.upsert  input

  • a target node   (required)   –   type: Node or NodeId.

    The node for which you want to upsert an embedding.

  • an embedding   (required)   –   type: a list of floating-point values.

    The embedding that you want to upsert for the target node.

    If the node has an existing embedding, this must match the dimension of the existing one or an exception is thrown.

.vectors.upsert  outputs

If the target node already has an existing embedding then .vectors.upsert replaces it with the one supplied. Otherwise .vectors.upsert adds the supplied embedding for the target node.

  • node   –   The target node.

  • embedding   –   The embedding that was supplied to be upserted.

  • success   –   A Boolean value: true indicates that the upsert succeded, and false that it failed.

.vectors.upsert  query examples

CALL neptune.algo.vectors.upsert( "person933", [0.1, 0.2, 0.3, ..] ) YIELD node, embedding, success RETURN node, embedding, success
UNWIND [ {id: "933", embedding: [1,2,3,4]}, {id: "934", embedding: [-1,-2,-3,-4]} ] as entry MATCH (n:person) WHERE id(n)=entry.id WITH n, entry.embedding as embedding CALL neptune.algo.vectors.upsert(n, embedding) YIELD success RETURN n, embedding, success

Sample  .vectors.upsert  output

Here is an example of the output returned by .vectors.upsert when run against the sample Wikipedia dataset using the following query:

aws neptune-graph execute-query \ --graph-identifier ${graphIdentifier} \ --query-string "MATCH (n{\`~id\`:\"0\"}) CALL neptune.algo.vectors.get(n) YIELD embedding AS vector MATCH (m{`~id`: '1'}) CALL neptune.algo.vectors.upsert(m, vector) YIELD node, embedding, success RETURN node, embedding, success" --language open_cypher \ /tmp/out.txt { "results": [ { "node": { "~id": "1", "~entityType": "node", "~labels": [], "~properties": { "title": "24-hour clock", "views": 2450.62548828125, "wiki_id": 9985, "paragraph_id": 1, "url": "https://simple.wikipedia.org/wiki?curid=9985", "langs": 30, "text": "A time in the 24-hour clock is written in the form hours:minutes (for example\\, 01:23)\\, or hours:minutes:seconds (01:23:45). Numbers under 10 have a zero in front (called a leading zero); e.g. 09:07. Under the 24-hour clock system\\, the day begins at midnight\\, 00:00\\, and the last minute of the day begins at 23:59 and ends at 24:00\\, which is identical to 00:00 of the following day. 12:00 can only be mid-day. Midnight is called 24:00 and is used to mean the end of the day and 00:00 is used to mean the beginning of the day. For example\\, you would say \"Tuesday at 24:00\" and \"Wednesday at 00:00\" to mean exactly the same time." } }, "embedding": [ 0.07711287587881088, 0.3197174072265625, -0.2051590085029602, 0.6302579045295715, 0.032093219459056857, 0.200703963637352, 0.16665680706501008, -0.31295087933540347, 0.17575109004974366, 0.5308129191398621, -0.37528499960899355, 0.3338659405708313, -0.046272162348032, 0.07841536402702332, -0.3490406274795532, 0.27182886004447939, 0.3073517680168152, -0.08306130766868592, 0.5035958886146545, 0.254621684551239, -0.40407684445381167, 0.28878292441368105, -0.22588828206062318, -0.13185778260231019, -0.21559733152389527, 0.4900434613227844, 0.03866531699895859, 0.507415771484375, -0.3067346513271332, 0.10740984976291657, 0.08998646587133408, -0.2652775049209595, -0.28492602705955508, 0.33600345253944399, -0.27227747440338137, 0.3691731095314026, -0.2815995514392853, 0.0856710895895958, -0.13187488913536073, 0.4753035008907318, -0.2241700142621994, 0.20263174176216126, 0.4390721619129181, 0.06424559652805329, 0.2463042289018631, -0.39631763100624087, 0.2971232533454895, 0.2415716052055359, -0.02803819440305233, 0.32105034589767458, -0.02222033031284809, -0.008510420098900795, -0.00032598740654066205, 0.031057516112923623, -0.5332233309745789, 0.45022767782211306, -0.6829474568367004, 1.3313145637512208, 0.19445496797561646, -0.15697629749774934, -0.09996363520622254, -0.2786232829093933, -0.09833164513111115, -0.17644722759723664, 0.11717787384986878, 0.2820119559764862, 0.029635537415742875, 0.5247654914855957, 0.5323811173439026, -0.06254086643457413, -0.05274389684200287, 0.3877565860748291, 0.43260684609413149, 0.5207982063293457, -0.27160540223121645, -0.06000519543886185, -0.032806672155857089, -0.3594319522380829, 0.4218965470790863, -0.3766363263130188, 0.44727250933647158, -0.04586323723196983, 0.06902860850095749, 0.3030509352684021, 0.18945887684822083, 0.21681705117225648, -0.014492596499621868, -0.38649576902389529, -0.1129651814699173, 0.050081491470336917, -0.01697717048227787, 0.1415158063173294, -0.3284287750720978, -0.02309800498187542, -0.2051207274198532, -0.017861712723970414, -0.07372242212295532, -0.12263767421245575, 0.21828559041023255, -0.36898064613342287, 0.3558262288570404, -0.16924124956130982, -0.31757786870002749, 0.5452765226364136, 0.24666202068328858, -0.08289600908756256, -0.14674079418182374, -0.18049933016300202, 0.3646247982978821, 0.42489132285118105, 0.0909421369433403, -0.1764664500951767, 0.22471413016319276, 0.049531541764736179, -0.022898104041814805, 0.08607156574726105, 0.14532636106014253, -0.205774188041687, -0.3457978069782257, -1.2771626710891724, 0.2826114892959595, 0.2066900134086609, -0.3884444832801819, -0.3564482629299164, -0.25118574500083926, -0.728326141834259, 0.5217206478118897, -0.43305152654647829, 0.3510914444923401, 0.5106240510940552, -0.11594267934560776, 0.43993058800697329, 0.25412991642951968, 0.4275965392589569, 0.1463870108127594, 0.3510439395904541, 0.1619710624217987, 0.11160195618867874, -0.22760489583015443, -0.23652249574661256, 0.05374380201101303, 0.7251803278923035, -0.13991153240203858, 0.9363659024238586, -0.05858418717980385, 0.5233941674232483, 0.12388131022453308, 0.6248424649238586, -0.11751417070627213, 0.09689709544181824, 0.7467237710952759, 0.2247271090745926, -0.6747357845306397, -0.16039365530014039, -0.41555172204971316, -0.04566565155982971, 0.21260707080364228, 0.2549103796482086, 0.24795542657375337, 0.5625612735748291, 0.8036459684371948, 0.15800043940544129, 0.04797195643186569, -0.15839435160160066, -0.06506697088479996, -0.2577322721481323, 0.3262946903705597, 0.5458049178123474, 0.616370439529419, -0.35092639923095705, 0.048758912831544879, 0.11522434651851654, 0.04175107553601265, -0.12269306182861328, 0.1227836161851883, 0.4020257890224457, 0.07093577086925507, -0.1880340874195099, 0.5334663391113281, 0.46888044476509097, 0.18104688823223115, 0.30756646394729617, 0.29316428303718569, -0.10604366660118103, 0.44999250769615176, 0.18227706849575044, 0.5962150692939758, 0.38278165459632876, -0.40461188554763796, 0.17775404453277589, -0.16349074244499207, 0.06950787454843521, 0.7547341585159302, -0.4842711389064789, 0.4062837064266205, 0.09000574052333832, 0.03859427571296692, 0.24143263697624207, -0.3383118510246277, 0.3363209366798401, 0.10778547078371048, 0.3429640233516693, -0.20395530760288239, 0.011477324180305004, 0.6145590543746948, -0.5488739609718323, -0.26194247603416445, -0.09723474085330963, -0.19020821154117585, -0.18068274855613709, 0.1601778119802475, 0.038950759917497638, 0.6372026205062866, -0.12897184491157533, 0.10720998793840409, 0.13482464849948884, -0.07540713250637055, -0.0881727784872055, 0.5626690983772278, -0.31975486874580386, -0.029084375128149987, 0.43618619441986086, 0.32975345849990847, -0.4053913652896881, 0.15788795053958894, -0.3212168216705322, -0.20272433757781983, -0.8973743319511414, 0.060059018433094028, -0.014103145338594914, -0.3387225568294525, -0.49839726090431216, -0.011007139459252358, -0.16101065278053285, -0.20850643515586854, 0.4891682267189026, 0.33551496267318728, -0.23595896363258363, -0.4257577359676361, -0.48884832859039309, 0.48760101199150088, 0.34031161665916445, 0.1722799688577652, -0.35575979948043826, 0.629051923751831, -0.8014369010925293, 0.575096607208252, 0.421142578125, -0.2668846547603607, -0.046029768884181979, 0.2791147530078888, -0.22112232446670533, 0.02008579671382904, 0.22087614238262177, -0.17961964011192323, 0.4235396981239319, 0.295818567276001, -0.18260923027992249, 0.3227207660675049, 0.11412205547094345, 0.04591478034853935, 0.5127033591270447, 0.428005576133728, 0.20718106627464295, 0.18405631184577943, -0.22416146099567414, 0.4277373254299164, 0.5384698510169983, 0.04109276458621025, 0.5105301141738892, 0.473961740732193, -0.6853302717208862, -0.16557902097702027, -0.12704522907733918, 0.0026600745040923359, 0.5272349715232849, 0.12121742218732834, 0.427141010761261, -0.3047095239162445, 0.5948843359947205, 0.335798442363739, 0.35749775171279909, -0.18497343361377717, 0.26501506567001345, 0.1564970314502716, 0.4210122525691986, -0.1915784478187561, 0.057152874767780307, -0.28498271107673647, 0.04969947412610054, 0.7697478532791138, 0.5546697974205017, 0.0958070456981659, -0.3533228933811188, 0.4784282147884369, 0.624963104724884, 0.2151053100824356, 0.17361000180244447, 0.22527147829532624, -0.12481484562158585, 0.4212929904460907, -0.2926572859287262, 0.2562543749809265, 0.38751208782196047, 0.1340814083814621, 0.0680900365114212, 0.2952287793159485, 0.12217980623245239, -0.2869758605957031, 0.15682946145534516, -0.022066200152039529, -0.09002991020679474, -0.2826828360557556, 0.84619140625, 0.7544476985931397, 0.5953861474990845, 0.6517565250396729, -0.07932830601930618, 0.22802823781967164, -0.135965958237648, -0.8263510465621948, -0.6325801610946655, -0.5928561091423035, 0.4108763635158539, 0.0964483916759491, -0.5045000910758972, -0.06772734969854355, -0.79107666015625, 0.060380879789590839, 0.015578197315335274, 0.32540079951286318, -0.044692762196063998, -0.17132098972797395, -0.19123415648937226, 0.17911623418331147, 0.3269428014755249, -0.22874118387699128, 0.4686919152736664, -0.15749554336071015, -0.25185921788215639, -0.21561351418495179, -0.10132477432489395, -0.057977184653282168, 0.09759098291397095, 0.16202516853809358, 0.01888692006468773, 0.1724688857793808, -0.3449697196483612, 0.4449881315231323, 0.10185430943965912, -0.2976726293563843, 0.06075461208820343, 0.21909406781196595, -0.07409229874610901, 0.6881160140037537, 0.17447273433208466, -0.048471711575984958, 0.5318611264228821, 0.30954766273498537, -0.24350836873054505, 0.14386573433876038, -0.10827953368425369, 0.08575868606567383, 0.14200334250926972, 0.5095603466033936, -0.025056177750229837, 0.24901045858860017, -0.23696841299533845, -0.03630203381180763, 0.45206722617149355, 0.5019969344139099, -0.21705971658229829, -0.08452687412500382, -0.10376924276351929, -0.3200875520706177, -0.2048267275094986, -0.2703971266746521, 0.2925371825695038, 0.3755778670310974, 0.2522588074207306, 0.22964833676815034, 0.7995960116386414, 0.12206973880529404, 0.2896155118942261, 0.04163726791739464, -0.12602514028549195, 0.004978220444172621, 0.3399927020072937, 0.09124521911144257, -0.5452605485916138, 0.2247130423784256, 0.23503662645816804, 0.06750215590000153, -0.2884872257709503, -0.2791622579097748, -0.1780446618795395, -0.44350507855415347, -0.1840016394853592, 0.8970789909362793, -0.3687478303909302, 0.36603569984436037, 0.23560358583927155, 0.020292289555072786, 0.2446030080318451, 4.3314642906188969, 0.194863960146904, -0.10218192636966706, 0.5695234537124634, 0.016988292336463929, -0.15768325328826905, 0.050476688891649249, 0.09948820620775223, -0.06554386019706726, 0.22301962971687318, -0.05468735471367836, 0.29051196575164797, 0.12100572139024735, 0.4127441644668579, 0.1667146235704422, 0.0587792843580246, -0.09758614003658295, -0.20510408282279969, -0.21746976673603059, 0.43335747718811037, -0.32159093022346499, 0.6942153573036194, 0.6173154711723328, 0.3104712665081024, 0.5751503109931946, 0.4174514412879944, -0.2948107421398163, 0.3532458245754242, 0.4869029223918915, 0.3115881681442261, 0.28135108947753909, 0.38450825214385989, 0.016915690153837205, -0.11598393321037293, -0.32250434160232546, -0.06988134980201721, 0.22417351603507996, -0.35582518577575686, 0.2677224576473236, 0.008019124157726765, -0.19177919626235963, 0.5731900334358215, -0.03540642186999321, 0.43302130699157717, 0.1796148121356964, -0.005056577268987894, 0.37953320145606997, 0.13488957285881043, 0.7240068912506104, -0.3088097870349884, 0.5610846281051636, -0.29582735896110537, -0.20909856259822846, -0.2881403863430023, 0.10329002141952515, 0.49255961179733279, 0.14558906853199006, 0.41020694375038149, 0.04002099484205246, -0.24476903676986695, -0.389543354511261, 0.3901459574699402, 0.6170359253883362, 0.18917717039585114, -0.41235554218292239, -0.19313344359397889, -0.10294703394174576, 0.5560699105262756, 0.5773581266403198, -0.17282086610794068, 0.28679269552230837, 0.34322652220726015, -0.07227988541126251, -0.5244243741035461, -0.26529040932655337, -0.11131077259778977, -0.19524210691452027, 0.4082769453525543, -0.009217939339578152, -0.1462743580341339, 0.7264918684959412, -0.09149657934904099, -0.3374916911125183, -0.05742226541042328, -0.3913151025772095, 0.7185215950012207, -0.3785516619682312, -0.00010882654169108719, 0.6655824780464172, 0.4194306433200836, 0.3726831376552582, -0.014721312560141087, 0.5345744490623474, 0.33022087812423708, -0.06344814598560333, -0.1560882031917572, 0.22698232531547547, -3.8697707653045656, 0.06812435388565064, -0.4368731677532196, -0.07041455805301666, -0.015291529707610608, -0.41140303015708926, 0.31612321734428408, 0.2914712429046631, -0.3867192566394806, -0.026363473385572435, -0.08788029104471207, -0.10701339691877365, -0.2673511505126953, 0.27538666129112246, -0.3661351501941681, 0.5879861116409302, 0.06352981925010681, 0.15547777712345124, 0.0863194614648819, -0.021183960139751436, 0.428565114736557, 0.04859453812241554, 0.35721391439437868, -0.3864029347896576, -0.20986808836460114, 0.15433000028133393, 0.25567296147346499, 0.25359275937080386, -0.4783596396446228, -0.010366495698690415, 0.4777776598930359, -0.029405448585748674, 0.3631121814250946, -0.18738743662834168, 0.2193489819765091, 0.7861229777336121, -0.01961355283856392, 0.16653983294963838, -0.4193624258041382, 0.3085209131240845, -0.03517897054553032, -0.035910699516534808, 0.37241387367248537, -0.13769084215164185, -0.08015040308237076, 0.4384872615337372, -0.12396809458732605, 0.15661391615867616, -0.3919837176799774, -0.6586825251579285, 0.5687432885169983, 0.0396936871111393, -0.09660491347312927, 0.05788198113441467, 0.48911261558532717, 0.5213083028793335, 0.3355415165424347, -0.006735790055245161, -0.11381038278341294, 0.09182903915643692, -0.11055094748735428, -0.28275448083877566, 0.24975340068340302, 0.11746659129858017, -0.42452141642570498, -0.2323901206254959, -0.38694220781326296, 0.015501483343541623, 0.6440262198448181, -0.3121536672115326, -0.08778296411037445, -0.14549347758293153, 0.01749151013791561, -0.5398207902908325, 0.4124368131160736, 0.5154116749763489, -0.34769660234451296, 0.5662841796875, 0.4989481270313263, 0.06761053949594498, 0.014184223487973214, 0.601079523563385, -0.3859538435935974, 0.3446619212627411, 2.190366744995117, 0.4051366150379181, 2.288928508758545, 0.5293960571289063, -0.3505767583847046, 0.5397417545318604, -0.6520821452140808, 0.4239364266395569, 0.2618080675601959, 0.20174439251422883, 0.030146604403853418, 0.0610184520483017, 0.062213074415922168, -0.11276254057884217, -0.1301877349615097, -0.19404706358909608, 0.5268515348434448, -0.7370991706848145, 0.028712594881653787, -0.4024544954299927, 0.18225152790546418, 0.7267741560935974, -0.2734072208404541, 0.1759040206670761, -0.2950340211391449, 0.14166314899921418, 0.6515365242958069, -0.29643580317497256, -0.06734377890825272, 0.09662584215402603, -0.010966300964355469, -0.3204823136329651, 0.6417866349220276, -0.051218003034591678, -0.008819818496704102, 0.5098630785942078, -0.21459998190402986, 4.437846660614014, -0.24779054522514344, 0.018799694254994394, -0.01747281290590763, -0.0487254373729229, 0.6121163964271545, 0.4686623811721802, -0.22926479578018189, -0.03692511469125748, -0.4286654591560364, 0.46073317527770998, 0.16875289380550385, -0.014255600981414318, -0.07684683054685593, 0.12223237752914429, -0.30599895119667055, 0.39215049147605898, 0.22453786432743073, 0.5624862313270569, -0.011985340155661106, 0.05180392041802406, 0.030400553718209268, 0.08391892164945603, 0.10214067250490189, -0.4449590742588043, 0.2225639522075653, 0.3862999975681305, 0.24732927978038789, -0.05571140721440315, -0.021564822643995286, 0.28468334674835207, 5.213898658752441, 0.13289497792720796, -0.1400047093629837, -0.39865049719810488, 0.12139834463596344, 0.45539018511772158, -0.1865275651216507, -0.08270177245140076, -0.38520801067352297, 0.08869948983192444, -0.05266271159052849, 0.14364486932754517, -0.2860695719718933, 0.4430652856826782, 0.7777798771858215, 0.21114271879196168, -0.358752578496933, -0.3664247989654541, 0.6665846109390259, -0.40493687987327578, 0.1747705042362213, -0.06670021265745163, 0.20972059667110444, -0.19101694226264954, 0.23892535269260407, -0.08149895817041397, 0.018510373309254648, 0.8112999796867371, 0.07871513813734055, 0.09570053964853287, 0.5030911564826965, 0.21463628113269807, -0.31457462906837466, 0.3051794767379761, -0.39506298303604128, 0.06605447828769684, 0.6144300699234009, -0.4566810429096222, 0.3146623373031616, 0.1887989640235901, 0.9544244408607483, 0.5103438496589661, -0.4859951138496399, -0.32647767663002016, -0.07584235072135925, 0.21474787592887879, -0.1920636147260666, -0.4472030997276306, 0.08618132770061493, -0.17384092509746552, -0.20969024300575257, -0.1831870973110199, 0.8782939314842224, -0.15720084309577943, 0.37347128987312319, 0.5088165998458862, 0.29395583271980288, -0.3580363988876343, -0.17590023577213288, -0.508141279220581, 0.4661521315574646, 0.142064169049263, -0.05615571141242981, 0.592810869216919, 0.37807324528694155, -0.14052101969718934, -0.19951890408992768, -0.12800109386444093, 0.748070478439331, 0.13753947615623475, -0.08446942269802094, 0.3747580945491791, -0.12847286462783814, -0.13892321288585664, 0.08525972813367844, 0.12516680359840394, 0.5701874494552612, -0.24708901345729829, 0.0679594948887825, 0.10870008915662766, 0.20561885833740235, -0.7872452139854431, 0.07303950190544129, 0.35694700479507449, 0.245212584733963, 0.3299793303012848, -0.010669616051018238, -0.12047348916530609, 0.3540535271167755, 0.32180890440940859, 0.3066200911998749, 0.021576205268502237, 0.17679384350776673, -0.23050960898399354, 0.1292697787284851, 0.022921407595276834, 0.5460971593856812, 0.3612038493156433, 0.1963733434677124, 0.4622957706451416, 0.16855642199516297, 0.2564740478992462, -0.27637141942977908, -0.16345584392547608, 0.08119463175535202, 0.07851938903331757, -0.5181471109390259, -0.5290305614471436, 0.5271350741386414, 0.3391841650009155, 0.501441240310669, 0.740936279296875, -0.26713573932647707, 0.030347898602485658, 0.05174243822693825 ], "success": true } ] }