UltipaDocs
Products
Solutions
Resources
Company
Start Free Trial
UltipaDocs
Start Free Trial
  • Introduction
  • GQL vs Other Languages
    • Overview
    • Node and Edge Patterns
    • Path Patterns
    • Quantified Paths
    • Questioned Paths
    • Shortest Paths
    • Cheapest Paths
    • K-Hop Traversal
    • Graph Patterns
    • Overview
    • Open Graph
    • Closed Graph
    • Graph Type
    • Constraints
    • Projections
    • Storage Maintenance
    • Unique Identifiers
    • INSERT
    • INSERT OVERWRITE
    • UPSERT
    • MERGE
    • SET
    • REMOVE
    • DELETE
    • FOREACH
    • Query Composition
    • Result Table and Visualization
    • MATCH
    • OPTIONAL MATCH
    • FILTER
    • LET
    • FOR
    • ORDER BY
    • LIMIT
    • SKIP
    • CALL
    • RETURN
    • Composite Query
    • NEXT
    • All Functions
    • Element Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Null Functions
    • Utility Functions
    • Type Conversion Functions
    • Table Functions
    • AI & Vector Functions
    • Database Functions
  • Operators
  • Predicates
    • CASE
    • LET Value Expression
    • Value Query Expression
    • List Comprehension
    • Index
    • Full-text Index
    • Vector Index
  • Transactions
  • Triggers
  • Query Management
  • Execution Plan
  • Backup and Restore
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Naming Conventions
    • Syntactic Notation
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. Query Acceleration

Vector Index

Overview

A vector index is designed to efficiently store and manage high-dimensional vectors (or embeddings), enabling fast retrieval of similar vectors based on a chosen similarity metric. Instead of performing an exhaustive search across all stored vectors, the vector index significantly reduces the search space, making nearest-neighbor retrieval more efficient.

Vectors and Embeddings

Vectors can be viewed as an ordered list of numbers. For example, the vector [1, 2] represents a direction from the origin to the point (1, 2) in a two-dimensional space, and the distance (or magnitude) to that point.

In the context of machine learning and natural language processing (NLP), the term embedding is commonly used when referring vectors. An embedding is a high-dimensional vector that represents data, often with hundreds of dimensions.

Creating Embeddings

You can create embeddings for both structured data (e.g., text) and unstructured data (e.g., images, graphs) using various models. Some popular models include:

  • OpenAI: A collection of models to turn text into embeddings.
  • Node2Vec: A model that generates embeddings for graph nodes based on their relationships.
  • ResNet (Residual Networks): A series of models for generating image embeddings.

Why Embeddings

Embeddings are often generated by considering the context of the data entity rather than just the data itself. This is especially true for tasks like NLP, where the meaning of a word is influenced by its surrounding context.

Consider the word "bank", which has multiple meanings depending on the context:

  1. Bank as a financial institution: "I went to the bank to deposit some money."
  2. Bank as the side of a river: "We sat on the bank of the river to watch the sunset."

This contextual information makes embeddings much more powerful for downstream tasks like semantic search, recommendation and classification.

Loading Embeddings into Ultipa

After creating embeddings, they can be stored in Ultipa using the ai.vector() function or imported as VECTOR properties. By creating vector indexes for these properties, you can perform vector searches.

Vector Search

Vector search refers to the process of finding vectors that are most similar to a given query vector, using a similarity measure. Ultipa supports the following similarity measures:

  • Euclidean Distance: Calculates the straight-line distance between two points in a high-dimensional space. This measure is sensitive to the magnitude of the vectors.
  • Cosine Similarity: Measures the cosine of the angle between two vectors, indicating their orientation in space. It is independent of vector magnitude.
  • Dot Product: Computes the dot product between two vectors, often used when the magnitude of the vectors is important.

Example Graph

The example graph consists of 10 Book nodes, each containing the properties name, author, summary, and summaryEmbedding. The summaryEmbedding holds the 384-dimensional text embeddings of the summary, generated using the all-MiniLM-L6-v2 model from Hugging Face.

GQL
INSERT (:Book {_id: 'B1', title: 'Pride and Prejudice', author: 'Jane Austen', summary: 'Elizabeth Bennet navigates love and social class in Regency-era England, clashing with the proud Mr. Darcy before realizing their true feelings for each other. The novel explores themes of marriage, reputation, and personal growth with Austen\'s sharp wit.', summaryEmbedding: ai.vector([-0.016981, -0.042364, 0.065666, 0.038906, 0.014976, 0.031358, 0.096271, -0.074125, -0.015277, 0.018961, -0.104336, 0.028773, 0.044179, -0.003503, -0.051337, 0.126421, -0.015187, -0.027225, 0.028287, 0.002713, -0.026236, 0.032444, 0.019729, 0.04396, -0.044703, -0.094819, 0.059223, 0.030913, -0.039863, 0.009686, -0.01894, 0.030413, 0.006824, 0.010569, -0.012861, 0.017635, 0.027373, 0.021346, 0.007833, 0.006646, -0.06523, -0.0176, -0.020286, 0.032384, -0.021207, -0.015802, -0.016896, -0.027521, -0.024199, -0.03487, 0.011316, 0.009509, -0.070896, -0.069814, 0.025057, 0.129979, -0.058228, 0.010542, 0.032511, -0.018214, 0.028891, -0.008495, 0.063497, 0.02867, 0.016084, 0.096362, -0.035903, 0.103503, -0.031934, -0.034265, 0.022387, -0.039978, 0.025089, -0.047174, 0.022442, -0.031838, -0.046405, -0.064129, -0.080437, -0.054828, -0.131105, -0.001171, 0.073839, 0.051653, 0.009277, -0.022276, 0.030624, -0.10131, -0.037987, -0.015313, -0.070821, -0.0613, -0.015217, 0.070322, -0.025163, 0.00224, 0.017138, -0.009221, -0.042655, 0.0309, -0.029513, 0.049603, -0.08939, 0.05721, -0.006558, -0.06228, -0.001606, -0.028527, 0.023108, -0.071744, 0.03202, -0.032745, -0.034466, -0.022568, 0.057977, -0.0705, 0.017743, 0.029623, 0.063704, 0.039302, 0.0351, 0.098135, -0.13042, -0.029174, -0.046425, -0.043677, 0.019011, 0.0, -0.049401, 0.019659, 0.00434, 0.103655, 0.03646, -0.006406, 0.01709, 0.010093, -0.035342, -0.021223, -0.02989, 0.004757, -0.04085, -0.049541, -0.028237, 0.010764, -0.023065, 0.019279, 0.043719, 0.022844, 0.005614, 0.047042, -0.00966, -0.028841, -0.141512, -0.046094, 0.093529, 0.076752, 0.051903, 0.005952, -0.009119, 0.010468, 0.020529, -0.117752, -0.025551, -0.020633, -0.035827, -0.045041, 0.021877, 0.104439, -0.102344, 0.061173, 0.051902, -0.033153, -0.108546, 0.025007, 0.072691, 0.077366, 0.011611, 0.04351, -0.025391, -0.05113, 0.007496, 0.034405, -0.02956, 0.068544, 0.001138, 0.003294, 0.053225, -0.050753, 0.111305, -0.119559, 0.030768, -0.083323, 0.027577, 0.056574, 0.018864, -0.054351, -0.049986, -0.049595, -0.053463, 0.13749, 0.00749, -0.015237, 0.026897, 0.05586, -0.053209, -0.045824, 0.002495, -0.041811, -0.088512, -0.045982, 0.001083, 0.0257, -0.025021, -0.056821, 0.079298, -0.04138, 0.05842, 0.12725, 0.075797, -0.063705, 0.02849, -0.059318, -0.056288, -0.0, 0.008574, 0.003689, -0.050495, 0.019619, 0.014629, -0.01671, -0.091144, -0.046019, 0.033841, 0.041957, 0.036199, -0.038631, 0.102301, 0.037733, -0.048338, -0.015469, 0.088624, -0.01908, 0.036952, -0.064097, 0.002211, -0.016333, -0.041148, -0.136672, 0.031455, 0.05582, -0.057396, -0.033742, -0.040174, 0.019922, 0.024373, 0.028434, -0.041116, -0.010636, 0.015855, 0.065905, 0.043568, -0.086017, 0.07593, 0.030394, -0.033286, -0.062302, -2.2e-05, 0.03797, 0.023304, 0.035934, 0.004769, 0.031986, 0.037367, 0.08025, 0.008816, 0.075706, 0.018465, -0.045595, 0.039721, -0.06825, 0.077457, 0.014606, -0.020432, 0.001111, -0.046646, 0.029667, -0.053344, 0.022936, -0.049127, 0.09749, -0.117611, 0.009198, 0.027363, 0.013929, -0.059453, -0.024981, -0.014964, -0.052099, -0.072152, -0.029434, 0.064085, -0.061669, -0.025979, 0.044384, -0.024857, -0.029748, 0.03433, 0.025258, -0.068556, -0.01208, 0.012232, 0.037907, -0.008201, -0.011246, -0.010428, -0.021744, 0.024465, -0.051146, 0.089513, -0.0, -0.088108, -0.059916, -0.068388, -0.033385, -0.011911, 0.046535, -0.013162, 0.038588, 0.013721, 0.082723, -0.063084, -0.020575, 0.003376, -0.028997, 0.024753, 0.066644, 0.130634, -0.075558, 0.01607, 0.009222, 0.08584, -0.006819, -0.008291, -0.028557, -0.043678, 0.028515, 0.039927, -0.062592, -0.011772, 0.066762, 0.027508, 0.049087, -0.044781, -0.011181, 0.01947, 0.042389, -0.043233, 0.150881, 0.056146, 0.058995, 0.006498, 0.0312, -0.048804, 0.042909, 0.055467, -0.010208, -0.039895, 0.025032, 0.003819, -0.007193, 0.067929, -0.006023, 0.100482, 0.045188, -0.026133, 0.041239, -0.00594, 0.043054, -0.029386, 0.037435, -0.055699, 0.083548, 0.020668, -0.081702])}),
       (:Book {_id: 'B2', title: '1984', author: 'George Orwell', summary: 'In a dystopian future, Winston Smith struggles under the oppressive rule of Big Brother, where thought control, surveillance, and propaganda dictate every aspect of life. His rebellion leads to devastating consequences, highlighting themes of totalitarianism and free will.', summaryEmbedding: ai.vector([-0.008621, 0.091217, -0.022469, -0.022307, 0.025421, 0.106667, 0.001754, -0.065709, -0.022435, 0.057827, -0.014686, 0.083507, 0.017244, -0.024383, -0.042809, 0.035961, -0.047049, -0.020921, -0.105624, 0.020044, -0.047525, -0.023805, 0.014186, 0.047439, -0.098367, 0.044126, 0.017014, 0.044188, -0.009684, -0.001128, -0.052091, -0.021865, 0.052238, 8.1e-05, 0.051572, 0.049274, 0.127821, 0.048921, -0.011751, -0.055761, 0.080929, 0.012329, -0.032541, 0.005175, 0.066084, -0.035489, 0.031082, -0.037632, -0.063821, -0.066129, -0.083817, -0.067446, 0.05262, -0.040641, 0.075976, -0.048971, 0.05027, 0.043345, -0.014722, -0.027574, -0.080322, -0.079703, -0.0453, -0.04559, 0.123172, 0.042333, -0.017341, 0.101922, -0.062573, 0.018903, -0.015795, -0.016941, 0.015264, -0.01361, -0.029711, -0.129424, -0.024845, -0.046623, 0.070202, 0.0443, 0.044555, -0.036263, -0.041683, 0.029205, -0.020685, -0.058189, -0.050959, -0.094882, 0.067173, 0.057603, -0.141696, -0.040523, 0.103626, 0.004706, -0.002419, 0.026994, 0.039842, -0.079611, -0.017373, 0.048091, -0.000586, -0.102408, 0.003314, 0.017276, 0.072057, -0.074581, 0.00571, 0.055517, 0.003812, -0.017347, -0.045918, -0.026583, -0.007081, -0.001156, 0.074983, -0.06314, 0.031952, 0.064857, -0.090344, -0.001005, -0.005211, 0.055158, 0.001642, 0.083283, 0.024727, 0.01225, -0.069203, 0.0, 0.058527, -0.06331, -0.026313, 0.106823, 0.020646, 0.066962, -0.014701, 0.012424, -0.048987, 0.016992, 0.030238, 0.009228, -0.001398, 0.003784, 0.008936, -0.02945, -0.10223, 0.00147, 0.057326, -0.004417, 0.037417, 0.039103, -0.065892, -0.049494, -0.01638, -0.058114, 0.00627, -0.021849, 6.9e-05, 0.03128, -0.008536, 0.13667, -0.079108, -0.003364, 0.062429, -0.021096, -0.076557, 0.02552, 0.072538, 0.018936, -0.06582, -0.002364, -0.042559, -0.046163, 0.02353, 0.025484, 0.134463, -0.015504, 0.008163, 0.015497, 0.032764, -0.014837, -0.021536, -0.026372, -0.019168, -0.018369, 0.012288, 0.022915, -0.038598, 0.013136, 0.038327, -0.033941, 0.029572, 0.038635, 0.010302, -0.096252, -0.063117, 0.023227, -0.033092, 0.116314, 0.05231, 0.036388, -0.001562, -0.031798, -0.018992, 0.052904, -0.07524, 0.066415, -0.099247, -0.013089, 0.023965, 0.021162, 0.022265, 0.004833, -0.001407, 0.03795, 0.055859, -0.092378, 0.026872, 0.004792, -0.003908, -0.093358, 0.039128, -0.020318, -0.091551, -0.0, -0.046535, -0.037969, -0.015275, 0.035466, 0.035897, -0.041856, -0.068587, -0.048424, 0.050674, 0.021732, -0.002393, -0.000446, 0.082799, 0.096639, 0.016579, -0.086886, -0.001073, -0.064376, 0.00767, -0.078391, 0.016434, -0.08163, -0.089212, -0.044454, 0.026081, 0.020704, -0.017052, 0.043146, 0.054896, 0.068385, -0.076187, 0.038646, -0.010708, 0.033081, 0.0199, 0.013365, -0.049776, -0.024593, 0.037183, -0.059185, -0.033034, -0.082648, -0.051082, -0.011112, -0.022965, 0.082457, -0.031499, 0.082153, 0.068979, 0.046753, -0.016227, 0.073926, 0.0606, 0.070905, -0.037076, -0.037028, -0.009335, 0.009383, -0.036358, 0.083562, -0.045985, -0.027577, -0.042756, 0.053987, -0.015786, 0.0039, 0.002802, -0.008193, 0.055457, 0.001805, 0.031887, -0.018394, -0.019132, -0.013288, -0.017759, 0.075113, 0.002179, 0.028745, -0.065958, 0.067536, 0.034431, -0.000787, -0.003597, 0.037126, -0.078908, 0.038574, 0.020738, 0.02015, -0.022434, 0.014085, -0.009719, -0.074353, 0.01077, -0.028893, -0.063277, -0.0, -0.034541, -0.070277, -0.01941, -0.005865, 0.025197, 0.156431, -0.007559, -0.010247, -0.017656, 0.143602, 0.005042, 0.009212, 0.025819, 0.01296, -0.00971, -0.007876, -0.002272, -0.197964, -0.02206, -0.039796, -0.022518, -0.032865, 0.007375, -0.003651, -0.0462, -0.005679, -0.053877, 0.004966, 0.024284, 0.092053, 0.022698, 0.004373, -0.056023, -0.000805, -0.045853, -0.01124, -0.048844, 0.054292, 0.060142, -0.035152, 0.073488, 0.012782, 0.007185, 0.053344, 0.046284, -0.038154, 0.002134, -0.022759, 0.018632, 0.004865, 0.007326, 0.072386, 0.065414, 0.088595, 0.060261, 0.038146, 0.006272, -0.009755, -0.043143, 0.096786, 0.053373, 0.038265, -0.018444, -0.088154])}),
       (:Book {_id: 'B3', title: 'To Kill a Mockingbird', author: 'Harper Lee', summary: 'Set in the racially segregated American South, young Scout Finch learns about justice, morality, and compassion as her father, Atticus, defends a Black man falsely accused of a crime. The novel critiques racial injustice and moral integrity.', summaryEmbedding: ai.vector([-0.022685, 0.015848, -0.092268, -0.005805, -0.022488, 0.068271, 0.02367, -0.076058, 0.001692, 0.054104, -0.019726, 0.049662, -0.032534, -0.060678, -0.057997, 0.038616, -0.001378, -0.045663, 0.056475, -0.062887, -0.051291, -0.001839, 0.047033, 0.018193, -0.087559, -0.004835, 0.029741, 0.033604, -0.075808, -0.034328, -0.011623, 0.056132, -0.029609, 0.05784, -0.053374, -0.008421, 0.059536, 0.011486, 0.040402, -0.053378, 0.034115, 0.047713, -0.029198, 0.033163, -0.048845, -0.015496, 0.014193, 0.01629, 0.016696, -0.048943, -0.02624, -0.002712, -0.052129, 0.017977, 0.036515, 0.192931, 0.049121, -0.052412, -0.014696, -0.055299, 0.017556, -0.059171, -0.04358, -0.000374, 0.08837, 0.016388, -0.023403, 0.02679, 0.026857, -0.019931, 0.089695, 0.01848, 0.033951, -0.002633, -0.015978, 0.060431, -0.002146, -0.072816, 0.083049, -0.054542, -0.122107, -0.063148, -0.018241, 0.001507, -0.029217, -0.055296, 0.014008, -0.070861, 0.026001, 0.041461, 0.005675, -0.070044, 0.024955, -0.031703, 0.00496, 0.00298, -0.046805, -0.014339, -0.024775, 0.0036, 0.026304, 0.031486, 0.033874, -0.097939, 0.007877, -0.128841, 0.069143, -0.060687, -0.05836, 0.013264, 0.020339, -0.014861, -0.048052, 0.113456, 0.057867, -0.039831, 0.1082, -0.024683, -0.009688, 0.106214, 0.049241, 0.043009, -0.098569, 0.050751, -0.035511, -0.025629, -0.055357, -0.0, 0.000344, -0.040222, 0.00126, -0.05498, 0.094356, 0.01413, -0.000924, 0.000857, -0.036914, 0.024803, -0.05189, -0.039218, -0.027427, 0.05707, 0.022623, 0.043282, -0.060139, -0.031055, 0.007903, -0.055285, -0.052262, 0.08655, -0.068716, -0.102307, -0.022458, -0.005139, -0.008208, -0.001491, -0.03777, 0.02958, 0.018564, 0.078021, 0.018519, 0.001198, 0.054522, 0.024294, -0.031691, -0.00452, 0.028008, 0.055869, 0.014879, -0.007362, 0.017005, 0.023753, 0.047535, -0.041846, -4.3e-05, -0.072499, -0.002898, 0.095969, -0.007599, -0.045246, 0.017599, -0.099306, 0.012444, 0.020177, -0.012894, 0.048299, 0.034884, -0.01905, 0.027787, -0.089254, 0.02116, -0.025526, 0.131431, -0.022242, -0.014277, -0.063793, -0.075555, -0.071412, -0.020671, -0.000502, 0.052591, 0.014231, -0.114578, 0.061905, 0.080356, 0.035511, -0.006664, -0.099888, -0.038341, 0.053163, 0.004475, 0.050597, -0.060631, -0.087168, 0.031206, -0.038886, 0.049127, -0.006717, 0.03515, 0.019972, -0.063002, -0.050685, -0.033951, -0.0, -0.051403, -0.076823, -0.019102, -0.015079, 0.006799, -0.006192, -0.06391, 0.018134, 0.046867, 0.04254, -0.14006, 0.001749, 0.087653, 0.043973, 0.010296, -0.062619, 0.006579, 0.056982, 0.056944, 0.004014, 0.026428, 0.085596, 0.031212, -0.009975, 0.077334, -0.067559, 0.054914, -0.007478, -0.07235, 0.017259, 0.026155, 0.013296, 0.055108, 0.010877, -0.037271, -0.053544, 0.138026, -0.051412, 0.019886, -0.026173, 0.010775, 0.044069, -0.030083, -0.065359, 0.025701, -0.048204, 0.041498, 0.045431, -0.065991, -0.000544, -0.03375, -0.082099, 0.064499, 0.036706, 0.040195, -0.090202, 0.000224, -0.013191, 0.041538, 0.022912, -0.06631, 0.038736, -0.075775, 0.012915, 0.030208, -0.051127, -0.101145, -0.050251, 0.011345, -0.014097, -0.042367, -0.070446, -0.046517, -0.055846, -0.028637, 0.060218, -0.003596, 0.043566, -0.046985, 0.011142, 0.027758, -0.038324, -0.034962, 0.100388, 0.032007, 0.058802, 0.022879, 0.071764, 0.040747, 0.009099, 0.011572, -0.011558, -0.026943, -0.002484, -0.08566, -0.0, 0.001474, 0.034781, 0.018348, 0.047107, -0.003245, 0.093578, 0.002771, -0.052211, 0.006837, 0.099092, -0.090545, -0.076021, 0.099739, -0.053151, -0.004243, 0.003036, 0.078226, -0.021979, -0.037188, 0.087974, 0.052597, 0.091232, 0.084083, 0.01447, 0.008634, 0.004507, -0.041514, -0.074261, -0.052054, 0.060658, 0.011223, 0.134636, 0.075156, -0.001989, -0.086357, -0.040823, 0.065953, 0.10817, 0.076068, 0.011597, -0.021968, -0.014809, -0.009644, -0.044707, 0.013019, -0.01213, 0.01389, 0.038917, 0.010552, 0.005413, -0.023689, 0.034866, 0.02901, -0.035532, 0.040918, -0.019797, 0.00846, -0.031901, -0.01225, -0.050796, 0.1209, 0.048805, -0.049166, -0.012392])}),
       (:Book {_id: 'B4', title: 'The Great Gatsby', author: 'F. Scott Fitzgerald', summary: 'Jay Gatsby, a wealthy but mysterious man, throws lavish parties in an attempt to win back his lost love, Daisy Buchanan. Through the eyes of Nick Carraway, the novel explores themes of the American Dream, class, and the illusions of wealth.', summaryEmbedding: ai.vector([-0.02481, -0.061498, -0.016459, 0.013824, 0.061165, 0.016651, 0.142201, -0.072818, 0.020808, -0.002779, -0.049229, 0.048879, 0.041182, -0.134283, -0.012917, -0.048263, -0.077979, -0.014902, 0.05853, 0.0264, -0.016752, 0.032369, -0.083641, -0.008015, -0.001195, -0.032516, 0.109321, -0.044194, -0.109634, 0.034549, 0.020258, 0.019063, -0.073458, 0.025434, -0.057394, 0.009432, 0.047803, 0.032902, -0.015933, -0.025801, -0.087016, -0.020839, 0.015638, 0.043783, 0.023102, -0.029874, -0.007379, -0.123993, 0.049499, -0.009779, 0.020158, 0.032399, -0.049439, -0.051735, 0.104907, 0.091621, 0.021406, 0.00272, 0.021135, 0.071739, 0.006356, -0.015859, 0.037401, -0.046381, 0.123268, 0.000124, -0.07015, 0.038322, -0.074761, 0.034271, 0.028509, 0.030658, -0.069122, -0.067256, -0.075874, -0.003074, -0.037567, 0.003349, -0.001743, 0.078347, -0.117151, -0.049647, 0.017345, -0.027313, -0.049133, -0.019061, -0.036887, -0.074609, -0.001043, 0.07469, -0.00765, -0.036249, 0.001913, 0.052002, -0.074449, -0.021182, -0.038632, -0.078172, -0.078873, 0.031107, 0.026107, 0.063358, 0.057954, -0.050606, 0.023983, -0.038648, 0.080144, 0.032675, -0.014176, 0.021173, -0.036661, -0.002756, -0.03222, 0.003514, 0.013504, 0.012299, -0.05979, -0.085184, -0.034601, 0.068569, 0.048107, 0.107345, -0.060121, 0.019972, -0.070312, -0.039605, 0.016218, -0.0, -0.010852, -0.026466, 0.061672, 0.041158, 0.004425, 0.078448, 0.020051, -0.006576, -0.05914, 0.011103, 0.00973, 0.034362, -0.089097, 0.01065, -0.009454, 0.056516, -0.136623, 0.002715, 0.103283, -0.003275, 0.015716, 0.080948, 0.017405, -0.069842, -0.051074, -0.080407, -0.05674, -0.063471, -0.034554, 0.021867, -0.053822, 0.057751, 0.052536, -0.008749, -0.081234, -0.115503, 0.007877, -0.020663, 0.039926, 0.040143, -0.079047, -0.000906, 0.033132, 0.055861, -0.071967, 0.086942, 0.14623, 0.065717, 0.037711, 0.0543, -0.038971, -0.064067, 0.011975, -0.02761, -0.020649, -0.018462, -0.055563, -0.054769, 0.032509, -0.098422, 0.097408, -0.025396, 0.101892, -0.050168, -0.034889, 0.089117, -0.002952, -0.102663, -0.027529, 0.040746, -0.02576, -0.028761, 0.03842, -0.011613, 0.016411, 0.064884, 0.052058, 0.051048, -0.051964, -0.051136, -0.013555, -0.030569, -0.008559, 0.029522, -0.030514, 0.029898, 0.054727, -0.087916, -0.054066, 0.030773, 0.034251, 0.009487, -0.074071, -0.098242, -0.062851, -0.0, 0.024773, -0.034948, 0.012849, -0.027455, 0.088715, -0.033244, -0.003161, -0.045451, 0.032735, 0.015709, -0.124888, 0.019781, 0.089965, -0.017727, 0.008002, -0.087125, 0.039819, -0.09049, 0.01425, -0.012974, 0.037084, 0.048912, 0.032509, -0.104437, 0.006037, -0.013321, 0.015617, -0.02299, -0.07817, -0.024479, 0.04568, 0.010375, -0.010518, 0.026609, -0.048428, -0.019848, 0.026159, -0.014288, -0.010499, -0.05043, -0.03114, -0.062367, 0.001141, 0.025411, -0.010856, -0.020467, -0.043565, 0.044189, 0.055517, 0.024321, 0.002447, 0.045537, 0.017321, 0.08497, -0.023826, 0.009052, 0.036428, 0.027111, 0.031905, 0.114385, -0.073044, 0.008308, -0.014239, 0.020909, 0.030084, -0.018945, 0.00614, 0.013544, 0.022179, 0.008652, -0.025928, -0.091711, 0.053577, 0.000107, -0.014363, 0.131351, 0.026427, 0.010441, 0.002405, 0.015217, 0.056033, 0.026832, 0.046974, -0.004158, -0.050433, 0.033239, -0.014378, 0.007379, 0.018452, 0.021353, -0.062961, -0.05227, 0.032829, -0.049616, -0.050346, -0.0, -0.067956, -0.03242, -0.016346, -0.034438, -0.039518, 0.065123, 0.029656, 0.028142, 0.008457, 0.091718, -0.015256, -0.039197, 0.079874, 0.031033, 0.031567, -0.058562, 0.124938, 0.006887, -0.024335, 0.045624, 0.067157, -0.005782, -0.009172, -0.037202, 0.002565, 0.087897, -0.005818, -0.027061, -0.015172, 0.128069, -0.008347, 0.017995, 0.002395, -0.013229, 0.011757, -0.02203, -0.05814, 0.064249, 0.022116, -0.033141, -0.007192, 0.017367, 0.031594, -0.0118, -0.025942, -0.013397, 0.077393, 0.055882, 0.06671, 0.089779, 0.059657, -0.001718, 0.04319, -0.018253, 0.027701, -0.094625, -0.031938, 0.047505, 0.020611, -0.02551, 0.020609, 0.012773, -0.040688, 0.028274])}),
       (:Book {_id: 'B5', title: 'Moby-Dick', author: 'Herman Melville', summary: 'Ishmael joins a whaling expedition led by the obsessed Captain Ahab, who is determined to hunt the white whale, Moby-Dick. The novel explores themes of fate, obsession, and the limits of human knowledge through rich symbolism and philosophical depth.', summaryEmbedding: ai.vector([0.024986, 0.089268, 0.002462, 0.056911, -0.017491, 0.006182, 0.069281, -0.011298, -0.058844, 0.095656, -0.033212, -0.048018, 0.019251, 0.007835, -0.014317, 0.036393, 0.051647, -0.066298, 0.007904, -0.009003, 0.025912, 0.082135, -0.004169, -0.071499, -0.068779, -0.033475, 0.043288, -0.098509, -0.061247, -0.027778, 0.038296, -0.017489, 0.049383, 0.03766, -0.001323, 0.018727, 0.081769, -0.0149, 0.050969, -0.023185, 0.051637, 0.05853, 0.00913, 0.058257, -0.077568, -0.028462, -0.021934, -0.013313, 0.027687, 0.0052, -0.087602, -0.0663, -0.010015, -0.110712, 0.09007, -0.026897, 0.03675, -0.056516, 0.035419, -0.129894, 0.027267, -0.026057, 0.034729, 0.005644, 0.102603, -0.047904, -0.009344, 0.022349, -0.040942, 0.006883, 0.011361, 0.008611, -0.004154, -0.016876, -0.01313, -0.052067, -0.006183, -0.035464, 0.055621, -0.024267, -0.135943, -0.106936, -0.013493, 0.018449, 0.016532, 0.013576, -0.012736, -0.046021, -0.011444, -0.055291, 0.017749, -0.147933, -8.1e-05, -0.028001, -0.001052, 0.019796, -0.041573, 0.057494, -0.075127, 0.021072, 0.007211, -0.036711, -0.064611, -0.050708, -0.04879, -0.082788, -0.027285, -0.016139, 0.01136, -0.063803, -0.098311, -0.037908, 0.031846, 0.100425, 0.053012, 0.021356, 0.017865, -0.023734, -0.033644, -0.075537, 0.056319, 0.051129, 0.112451, 0.047294, -0.023279, -0.033195, 0.024845, -0.0, -0.001234, -0.051258, 0.00492, -0.007569, 0.042704, -0.002179, -0.0157, -0.007016, -0.03177, 0.001527, -0.005795, 0.035909, -0.006185, 0.119219, -0.042984, -0.051231, -0.003651, -0.033617, 0.030648, -0.046417, -0.014707, 0.054663, -0.005389, -0.026723, -0.043323, -0.064387, 0.004754, -0.037245, 0.022693, 0.089803, -0.051133, 0.020015, -0.057522, -0.014337, -0.057065, -0.031319, -0.091167, -0.00755, -0.0248, -0.094236, -0.003888, 0.019184, -0.050137, -0.022002, -0.073743, 0.108872, 0.066098, -0.021434, -0.01049, 0.054411, -0.036552, -0.021467, 0.060354, -0.064676, -0.007327, -0.002849, 0.058975, 0.044744, 0.031761, -0.042444, 0.011187, 0.005927, 0.012879, 0.099982, 0.058164, 0.050856, 0.091121, -0.052411, 0.025609, 0.068554, 0.00213, 0.039209, 0.03737, -0.00952, -0.109022, 0.022982, 0.027525, -0.003349, -0.098386, -0.044324, -0.030998, 0.025196, 0.012077, 0.001514, -0.050782, 0.010763, 0.102044, -0.073122, -0.001126, 0.029476, 0.060785, -0.033116, -0.042406, -0.072633, -0.01464, 0.0, 0.032076, -0.036369, 0.004868, -0.032269, 0.009427, -0.036844, 0.058991, 0.070871, -0.021884, -0.094925, -0.059264, -0.059758, 0.025842, 0.012715, 0.112768, -0.028522, 0.03887, 0.034485, 0.055494, -0.074663, 0.009614, -0.036765, -0.01732, -0.069716, 0.07336, 0.071665, -0.025984, 0.000679, -0.077052, -0.027983, -0.026014, 0.103975, 0.029391, -0.053237, -0.075429, 0.063725, 0.040997, 0.055177, 0.028118, -0.017124, -0.017628, -0.000664, -0.006777, -0.037269, -0.04876, 0.037831, -0.034018, 0.115962, -0.024095, -0.000249, -0.005647, 0.039172, 0.106592, -0.085204, 0.061715, 0.042662, -0.021477, -0.032446, 0.039852, 0.001872, -0.060029, -0.042848, 0.041087, 0.032727, -0.040228, 0.002983, 0.008411, -0.090762, -0.009637, 0.017465, -0.003444, -0.073146, -0.052097, 0.03692, 0.013062, 0.046833, -0.096567, 0.026681, -0.039308, 0.040154, -0.054448, -0.004534, 0.018972, 0.11418, 0.032343, 0.008066, -0.023917, 0.089204, 0.046101, -0.017465, -0.041015, -0.053506, -0.024774, 0.033292, 0.012615, -0.0, -0.051662, -0.056536, 0.075332, -0.014211, 0.06104, 0.095765, -0.035307, 0.009331, -0.016606, 0.097363, 0.009923, 0.018415, 0.013492, 0.092102, -0.010562, -0.030544, 0.076898, -0.085053, -0.010554, -0.012726, 0.014894, -0.003037, 0.030773, -0.049188, -0.023961, 0.114537, -0.051036, -0.08396, 0.048463, 0.04152, 0.017938, 0.05466, -0.012975, -0.009366, -0.041479, 0.06124, -0.020477, -0.003307, 0.027755, 0.058596, 0.021437, 0.142451, 0.078608, 0.080473, 0.05182, 0.009803, 0.018128, 0.022249, -0.039128, -0.051696, -0.045714, 0.024123, 0.036962, 0.030822, 0.007994, -0.077624, -0.068565, 0.010505, -0.028864, 0.056541, 0.185368, -0.006059, -0.011937, 0.007561])}),
       (:Book {_id: 'B6', title: 'Crime and Punishment', author: 'Fyodor Dostoevsky', summary: 'Raskolnikov, a destitute student in St. Petersburg, commits murder under the belief that he is above moral law. As guilt consumes him, he is drawn into a psychological battle with an investigator, ultimately finding redemption through suffering and confession.', summaryEmbedding: ai.vector([-0.005746, 0.055988, -0.13981, 0.034377, 0.073211, -0.025192, 0.039414, 0.02614, 0.016537, 0.052656, 0.018935, 0.0347, -0.026677, 0.0725, -0.027476, -0.017418, -0.018498, 0.023923, -0.027701, 0.021797, -0.078968, -0.077619, 0.11921, -0.102545, 0.077975, 0.01584, 0.059991, -0.003676, -0.028952, -0.00785, -0.001603, -0.029296, 0.046073, 0.037007, 0.012328, 0.047972, -0.011646, 0.055175, -0.042309, 0.097293, -0.050229, 0.014376, 0.002547, 0.064158, -0.01945, -0.038625, -0.109628, -0.001013, 0.056956, -0.081477, -0.159172, 0.00953, -0.079107, 0.039161, -0.012838, -0.064483, 0.033846, 0.045292, -0.031192, -0.033835, 0.0777, 0.005205, -0.042888, -0.009348, -0.021094, -0.022319, 0.020205, 0.041475, -0.001329, 0.07305, 0.078324, -0.006299, -0.034242, -0.064566, -0.116704, -0.002941, 0.00896, 0.005175, 0.046975, 0.007779, 0.050727, -0.032339, 0.017511, -0.009087, -0.005941, -0.008464, 0.074875, -0.065548, 0.074677, 0.025667, -0.013692, -0.010992, 0.066441, -0.11594, -0.020848, 0.041044, -0.035696, 0.034047, -0.080847, 0.028601, -0.065866, -0.063303, 0.024242, -0.051987, -0.00394, 0.035361, -0.068607, -0.028621, -0.018264, -0.023659, -0.018068, 0.010826, -0.037121, 0.027646, 0.147516, 0.074995, 0.033555, 0.034059, -0.085895, 0.068073, 0.057082, 0.003678, -0.072365, 0.06514, -0.005044, -0.002203, -0.060674, 0.0, 0.003424, -0.030131, -0.05427, -0.083887, -0.021993, -0.024428, -0.042837, -0.001196, 0.009994, 0.117412, 0.021904, -0.044558, -0.049812, 0.048487, -0.067086, 0.100212, 0.00388, -0.01634, -0.064747, 0.081023, 0.089131, 0.024081, -0.012508, -0.001706, -0.11111, -0.047178, 0.022959, -0.017247, -0.008692, -0.002073, -0.025543, 0.02156, -0.02727, 0.030173, -0.042, 0.035403, -0.058783, -0.002002, 0.018528, 0.019429, -0.009486, -0.016824, -0.012513, 0.018614, 0.037413, -0.009725, 0.002309, -0.097262, 0.009947, 0.093972, -0.064316, -0.044598, 0.032113, 0.010113, -0.024806, 0.052718, -0.002825, 0.038685, 0.02499, -0.016412, 0.002405, -0.053559, -0.065159, -0.016558, -0.010882, -0.107866, 0.033846, -0.012336, 0.004257, -0.037368, -0.024805, 0.008619, -0.002165, -0.034263, -0.037685, -0.012282, -0.015092, -0.017186, 0.014866, -0.011953, -0.060926, 0.011058, -0.000645, 0.010369, -0.062733, 0.098853, -0.006584, -0.092125, 0.005484, 0.033885, -0.002268, -0.060514, 0.027181, -0.003506, -0.036113, -0.0, 0.056272, -0.065163, -0.056951, 0.028432, 0.013235, 0.010438, -0.029593, 0.018381, -0.06453, -0.015357, -0.003428, -0.076944, 0.040147, 0.160506, 0.046943, -0.079662, 0.068787, 0.0554, -0.094236, -0.023983, -0.001392, 0.078512, 0.006767, 0.029464, 0.045002, -0.011936, 0.114471, -0.01393, -0.121687, 0.051634, 0.023189, 0.053876, -0.01963, -0.026283, 0.046511, 0.028224, 0.140167, -0.016735, -0.092401, -0.005554, 0.0159, 0.006074, -0.047027, 0.031955, -0.036861, -0.073613, 0.016842, 0.150527, 0.084991, -0.128884, -0.049294, -0.003204, 0.021601, 0.039839, 0.002886, -0.009057, -0.036102, -0.040845, 0.020068, 0.033008, -0.034531, -0.072839, 0.018869, 0.093317, 0.0236, 0.071292, -0.023118, -0.039622, -0.049368, -0.010895, -0.012747, -0.028605, -0.012168, 0.02488, 0.006548, -0.014851, -0.027014, 0.022936, -0.015811, -0.066755, 0.084534, -0.116532, -0.042418, 0.064624, -0.044151, -0.042124, -0.01888, -0.072068, 0.038346, -0.049078, -0.025022, 0.008454, -0.007817, 0.014917, 0.02355, -0.0, 0.037923, 0.039917, -0.017496, -0.024757, 0.02151, 0.037723, -0.077877, -0.040243, -0.075173, 0.144728, -0.045712, 0.067646, 0.03741, 0.02065, 0.022836, 0.004735, 0.127762, 0.030299, 0.014688, 0.009962, 0.063411, -0.039163, 0.051119, -0.00729, 0.025761, 0.016705, -0.0045, 0.027566, 0.036776, 0.078343, -0.005368, 0.0873, 0.01514, 0.033563, 0.033052, -0.063143, 0.029269, 0.011762, -0.034033, -0.066038, 0.01368, 0.020722, 0.031004, -0.012194, -0.02145, -0.025953, 0.003065, -0.055487, 0.039679, 0.068359, -0.009597, 0.058518, -0.007604, 0.023715, 0.036578, -0.065714, 0.015161, 0.032566, -0.104722, -0.01596, 0.08477, -0.011824, 0.001901, -0.095109])}),
       (:Book {_id: 'B7', title: 'Brave New World', author: 'Aldous Huxley', summary: 'In a future society where pleasure, consumerism, and genetic engineering maintain stability, Bernard Marx questions the cost of happiness. When he introduces a \'savage\' to this world, the encounter exposes the dark side of a society that sacrifices individuality for order.', summaryEmbedding: ai.vector([-0.017259, 0.103397, -0.044578, 0.057012, 0.031334, 0.022794, 0.034241, 0.022861, -0.022973, -0.002988, 0.026662, 0.011121, 0.007896, -0.016325, -0.067179, -0.015455, -0.02687, -0.027194, -0.021197, 0.040037, -0.066882, -0.024336, -0.019088, 0.022188, -0.093807, -0.045609, 0.059535, -0.029698, 0.003686, 0.004405, 0.05633, -0.017466, 0.100844, 0.010182, 0.017576, 0.002719, 0.051209, -0.040099, -0.011043, -0.02955, 0.034576, -0.0445, -0.104234, -0.007111, 0.013781, -0.008157, 0.040142, -0.048667, -0.035672, -0.054672, -0.048576, -0.063592, -0.034244, -0.069988, 0.004488, 0.021394, 0.095717, -0.014006, -0.013539, 0.038022, -0.013671, -0.038218, -0.018888, 0.002637, 0.182136, -0.004898, 0.026355, 0.082061, -0.160809, 0.063882, -0.002202, -0.054789, 0.02606, -0.021259, 0.019636, -0.039003, 0.008656, -0.031885, -0.01666, 0.043713, 0.061052, -0.049492, -0.091198, -0.011191, -0.034691, -0.047018, 0.027816, -0.033231, 0.124252, 0.040856, -0.106303, -0.028136, 0.019898, 0.01694, -0.031328, 0.063509, -0.036953, -0.012367, -0.045935, 0.013576, -0.036081, -0.000299, 0.050027, 0.002613, 0.009789, -0.100088, -0.060031, 0.045898, 0.005561, -0.023754, -0.086314, -0.031876, 0.062488, 0.011988, 0.083099, -0.048623, 0.002851, -0.019463, -0.008752, -0.058591, 0.039104, 0.017159, -0.006463, 0.067699, -0.02607, -0.010121, -0.031432, -0.0, -0.059153, -0.055743, -0.005979, 0.032122, -0.057076, 0.018289, -0.023364, -0.003988, -0.053989, 0.03556, -0.022213, -0.013591, 0.007464, 0.151852, -0.047806, -0.038157, -0.055994, 0.022578, 0.048228, 0.012102, -0.021222, 0.019579, 0.033437, -0.038491, -0.014621, 0.024808, 0.007354, -0.059838, 0.009424, -0.005229, -0.04259, 0.134666, -0.015073, -0.062844, 0.094071, 0.080422, -0.029047, 0.017782, -0.027375, -0.009948, -0.08347, 0.037524, -0.036121, -0.036947, 0.040124, 0.070759, 0.144785, -0.012351, -0.056183, 0.032976, -0.048213, 0.009762, 0.046677, -0.041434, 0.039932, -0.047815, -0.017547, 0.051449, -0.042486, -0.068182, -0.023444, -0.077995, -0.020526, -0.077629, 0.059145, 0.021055, -0.008027, -0.023492, -0.005272, 0.057566, 0.067111, 0.022477, -0.050164, -0.058129, -0.028983, 0.06934, -0.037777, 0.076068, -0.023604, -0.021174, -0.022995, 0.014497, -0.080644, -0.046228, 0.075724, 0.058318, 0.087946, -0.039721, 0.031617, 0.064175, -0.032576, -0.072969, 0.07993, 0.039232, -0.058019, -0.0, 0.001815, -0.062184, -0.091704, 0.063733, 0.034464, 0.003755, -0.107276, -0.016212, -0.038049, 0.109781, 0.052522, -0.035196, 0.096909, 0.064796, 0.041481, -0.066994, -0.004088, -0.031193, -0.016678, -0.020756, -0.017423, 0.097273, -0.064645, -0.007434, -0.046206, 0.063278, -0.0058, 0.019352, -0.01875, -0.038287, -0.131971, 0.069609, -0.026389, -0.007952, 0.094204, 0.114747, -0.02225, 0.045546, 0.022435, 0.02553, -0.02942, 0.043162, -0.014631, 0.038077, 0.022828, 0.02986, -0.038594, -0.040013, 0.053952, 0.075722, 0.066878, 0.048534, 0.017969, -0.007684, 0.000458, -0.058613, -0.000653, -0.051559, 0.01129, -0.001066, -0.099043, 0.00275, -0.011683, 0.072238, -0.036786, -0.028156, -0.025493, -0.0271, -0.015456, -0.004339, 0.024932, -0.064066, -0.017364, -0.06969, -0.091319, 0.010456, -0.01095, 0.098159, 0.034705, -0.010277, 0.009045, -0.06952, 0.096122, 0.012518, -0.091869, -0.070418, -0.06481, 0.009472, 0.049188, 0.036197, -0.052241, -0.072664, -0.04769, -0.0598, 0.040116, -0.0, -0.04121, -0.086154, -0.036936, 0.004692, 0.044768, 0.056503, 0.001971, -0.020422, -0.028664, 0.171012, 0.002293, 0.081149, 0.045766, 0.090965, -0.032764, 0.064438, -0.008772, -0.053547, -0.021336, 0.005231, 0.025296, 0.034145, 0.039741, -0.010729, -0.04986, 0.019436, -0.001679, -0.059775, -0.019667, 0.038212, 0.040332, 0.029997, -0.046977, -0.059819, 0.018583, -0.002212, -0.05785, 0.039357, 0.058167, 0.025605, 0.010614, 0.09199, -0.011093, 0.020555, 0.021215, -0.033353, -0.015415, 0.031244, -0.036662, 0.058039, -0.024264, -0.017294, 0.020135, -0.046477, 0.008696, -0.108873, 0.029367, 0.030776, -0.051613, 0.042767, 0.098425, -0.019779, 0.048419, -0.094105])}),
       (:Book {_id: 'B8', title: 'The Catcher in the Rye', author: 'J.D. Salinger', summary: 'Teenager Holden Caulfield narrates his journey through New York City after being expelled from prep school, revealing his struggles with identity, alienation, and the transition into adulthood. His cynical yet vulnerable perspective has resonated with generations of readers.', summaryEmbedding: ai.vector([0.032516, -0.009188, 0.070708, -0.019265, 0.024578, 0.04688, 0.046333, -0.046068, -0.005468, -0.009286, 0.050508, -0.024029, -0.091306, 0.016981, -0.082689, 0.009934, -0.017832, -0.003675, -0.001866, 0.002027, -0.054152, -0.018572, -0.055326, 0.010868, 0.03393, 0.10297, 0.031146, 0.025373, -0.10103, 0.017887, 0.005652, 0.038809, -0.030148, 0.006738, 0.022013, 0.027957, 0.067862, 0.052333, 0.032198, -0.046697, -0.049901, 0.025845, -0.052898, 0.062259, -0.008954, -0.120789, -0.015074, -0.026156, 0.087438, -0.080062, -0.093308, -0.014656, 0.003864, 0.011168, -0.038792, 0.102395, 0.034344, 0.055851, 0.043417, -0.010732, -0.036203, -0.107561, 0.014454, 0.030576, 0.054101, -0.000634, -0.056048, 0.027261, -0.00961, 0.050651, -0.053551, 0.077111, 0.054687, -0.020911, -0.010324, 0.01064, -0.041549, 0.006844, 0.13777, -0.002886, 0.04313, -0.007095, -0.05359, 0.023936, -0.039793, -0.090577, 0.054861, -0.055177, 0.009262, 0.11014, -0.01926, -0.019301, -0.036056, 0.04318, -0.102316, -0.047716, 0.022808, 0.009633, -0.006712, -0.015204, 0.022175, 0.023645, 0.067269, 0.026089, -0.004237, -0.098668, -0.011476, -0.054106, -0.049758, 0.00528, 0.000898, -0.002572, -0.061696, 0.02992, 0.112779, 0.056855, 0.037696, -0.020957, -0.060573, 0.017309, 0.021296, 0.03497, -0.109468, 0.012613, -0.093845, -0.012833, 0.006813, 0.0, 0.01861, 0.025903, -0.010538, 0.095405, 0.053369, -0.030506, -0.004146, 0.085971, -0.022108, -0.05387, 0.030915, -0.004592, -0.053619, -0.091326, -0.022563, 0.046108, -0.108041, -0.058061, 0.064044, -0.0, 0.01255, 0.078234, -0.040699, -0.063814, -0.06923, -0.030468, -0.013631, -0.005722, -0.091977, 0.036681, -0.00338, 0.112093, -0.020484, -0.015726, 0.018899, -0.002446, 0.083236, -0.062863, 0.066971, -0.027222, -0.021017, -0.029076, 0.055889, -0.00695, 0.018233, 0.02785, 0.000561, -0.007028, 0.027473, 0.103516, 0.021181, -0.005933, -0.026229, -0.078342, -0.020563, 0.060083, -0.047893, -0.031141, 0.030236, -0.060851, 0.067715, 0.005657, -0.013435, 0.002945, -0.001535, -0.018559, 0.019184, -0.084974, -0.003402, 0.091859, -0.098081, 0.021993, -0.055955, 0.001308, -0.045453, 0.000735, -0.022333, -0.002646, -0.012392, -0.021156, -0.005981, 0.015047, -0.033866, 0.009798, 0.011691, -0.025041, 0.031571, -0.027014, 0.014956, 0.087836, 0.020295, -0.059869, -0.037173, -0.032808, -0.038437, -0.0, 0.130383, -0.097648, -0.01345, -0.024089, -0.007528, -0.010827, -0.029024, 0.047052, 0.089843, -0.021309, -0.09966, 0.037208, 0.138622, 0.039927, 0.00776, -0.017999, 0.041434, -0.019933, -0.104815, -0.07539, 0.071844, 0.051161, -0.111602, -0.01012, -0.022304, -0.05764, 0.07425, -0.025308, -0.109585, -0.014645, 0.118982, -0.030364, 0.074366, -0.036482, -0.093324, 0.025669, 0.03087, -0.016928, -0.034251, -0.008257, -0.000733, -0.088972, -0.014655, 0.028086, -0.045136, 0.014018, 0.004095, 0.073507, 0.006848, 0.122741, -0.036462, 0.048057, -0.003983, 0.063989, -0.000673, -0.020356, -0.031439, -0.049426, -0.06523, 0.046475, 0.009235, -0.00081, -0.130924, -0.087942, 0.033968, -0.0905, -0.131149, -0.082562, -0.006921, -0.006768, 0.031388, -0.02051, -0.047359, -0.014786, 0.02527, 0.003396, 0.00095, 0.006488, -0.041579, 0.02919, 0.093931, 0.013374, 0.013243, 0.052375, -0.042649, 0.041872, 0.007156, -0.012531, 0.017346, 0.000636, 0.087647, -0.043146, -0.081706, -0.072325, -0.03088, -0.0, -0.024789, 0.039127, -0.019309, -0.012856, -0.013551, 0.116218, 0.044275, 0.005258, 0.050627, 0.057412, -0.026978, -0.025628, 0.06918, 0.01821, -0.001116, 0.004494, 0.060615, -0.048426, -0.061664, 0.014049, -0.012403, 0.007233, -0.036198, 0.07537, -0.006816, 0.030819, -0.046416, -0.124791, -0.02238, 0.070236, -0.031736, 0.018288, 0.069545, 0.023002, -0.072263, 0.036903, 0.027269, 0.006707, 0.017548, -0.007912, 0.07548, -0.023146, -0.00237, 0.024605, -0.070593, 0.0289, -0.000821, 0.014243, 0.034212, 0.079833, 0.014773, 0.006133, 0.028424, 0.031948, 0.011631, -0.004776, -0.041419, 0.067557, -0.101373, 0.006203, 0.136539, 0.046626, -0.00234, 0.014882])}),
       (:Book {_id: 'B9', title: 'Frankenstein', author: 'Mary Shelley', summary: 'Victor Frankenstein, a scientist obsessed with creating life, brings a monstrous being to existence but abandons it in fear. The novel explores themes of scientific responsibility, the nature of humanity, and the consequences of unchecked ambition.', summaryEmbedding: ai.vector([-0.046957, 0.065709, 0.006964, 0.074613, 0.034062, 0.013721, -0.005549, 0.029249, 0.000332, 0.013605, -0.087653, 0.000806, 0.030134, 0.025927, -0.132973, 0.013286, -0.08689, -0.024487, 0.018571, 0.013847, 0.017783, 0.01117, -0.017028, 0.002927, -0.041043, -0.008277, 0.070023, -0.071365, -0.070602, 0.020261, 0.028651, -0.012192, 0.050337, -0.067922, 0.065252, -0.048554, 0.058497, 0.003249, -0.017292, 0.004034, -0.061412, 0.006066, -0.048584, 0.082069, -0.037084, -0.073443, -0.072632, -0.02487, -0.001188, -0.05623, -0.093962, -0.098287, -0.023887, -0.123958, 0.059134, 0.056979, 0.054287, -0.005143, 0.009065, -0.084629, 0.100587, -0.015422, 0.005776, -0.021798, 0.102462, 0.043887, -0.003097, 0.025339, -0.099009, 0.086806, 0.034008, 0.004046, 0.088577, -0.063542, 0.130197, -0.102255, -0.067873, -0.01635, 0.067604, 0.04946, 0.02878, -0.034084, -0.022238, -0.032514, -0.010374, 0.009968, 0.054338, -0.0125, 0.039438, 0.076097, -0.104244, -0.173754, -0.00499, 0.028141, -0.081569, 0.096396, -0.03934, -0.015966, -0.012415, -0.030318, -0.033095, -0.018633, -0.018929, 0.043378, 0.077408, -0.019857, -0.032045, -0.024655, 0.003373, 0.074312, 0.007736, -0.029905, -0.002242, 0.063644, 0.082125, 0.047666, -0.037057, 0.024977, 0.014368, 0.092005, 0.067945, 0.068438, -0.083451, 0.061588, -0.010636, 0.008954, -0.009939, -0.0, 0.046386, -0.048714, 0.006538, 0.020605, 0.012755, -0.019373, -0.010894, 0.012077, 0.005244, 0.023393, -0.069603, -0.038577, -0.001455, 0.102321, -0.08288, -0.000323, -0.004269, 0.00415, 0.0508, 0.033135, -0.015115, -0.015371, -0.051328, -0.028962, -0.017519, -0.026, -0.074493, -0.018086, -0.00855, 0.02393, -0.012138, 0.033631, -0.041032, -0.046827, 0.006388, -0.019737, -0.079612, 0.011288, -0.023815, 0.073309, -0.026024, 0.094112, -0.04673, -0.014092, 0.042174, 0.040827, 0.082546, 0.017058, 0.005469, 0.039375, -0.038968, -0.006206, 0.054017, -0.03432, 0.032128, -0.016339, 0.011811, 0.001455, 0.010581, -0.086398, 0.034789, -0.017112, 0.011433, 0.033822, 0.086371, -0.027885, 0.042008, -0.000508, -0.025593, -0.00046, -0.083407, -0.042187, -0.013563, 0.023569, -0.03534, 0.02856, 0.064611, -0.058498, -0.059068, -0.040961, -0.004412, -0.048576, -0.003099, -0.100415, -0.015751, 0.012457, -0.031247, -0.062095, -0.027132, 0.087159, 0.023244, -0.099496, -0.000599, -0.008039, -0.099082, 0.0, -0.00197, -0.100289, -0.030447, -0.035856, -0.024363, 0.005893, -0.158863, 0.00279, 0.010152, 0.003433, -0.05904, -0.004651, 0.123386, 0.005394, 0.013287, -0.042991, -0.052677, -0.020915, -0.031895, -0.007524, -0.029103, 0.048246, -0.07186, -0.08467, -0.000752, 0.056677, 0.013265, 0.020505, -0.027982, 0.03428, -0.03972, 0.003048, 0.020467, -0.049868, 0.042837, 0.064849, 0.078438, -0.015103, 0.107605, 0.015397, -0.034365, -0.007836, -0.052174, 0.056569, 0.053367, 0.044222, 0.038088, 0.006299, 0.061455, 0.009697, -0.019882, 0.027669, 0.023709, -0.047638, -0.018196, -0.081687, -0.023736, -0.05436, 0.069259, 0.166616, 0.014344, 0.037047, -0.035921, 0.123174, -0.069315, 0.022176, -0.064132, 0.071471, 0.008736, 0.010309, -0.062187, -0.04786, -0.031875, 0.010754, -0.022127, -0.021731, -0.050632, 0.020045, -0.049533, 0.07435, 0.020031, -0.030537, 0.072515, 0.051656, 0.001765, -0.066195, -0.008856, 0.029652, -0.016023, 0.030355, -0.054704, -0.009417, -0.034567, 0.008769, 0.009084, -0.0, 0.092742, 0.006955, 0.007568, -0.044769, 0.024518, 0.015511, -0.035874, -0.063806, -0.068324, 0.087327, -0.061477, 0.016215, -0.029122, 0.093099, 0.046687, 0.014538, 0.093185, -0.037018, -0.061453, 0.010765, 0.092208, 0.0409, -0.017275, -0.083655, 0.012716, 0.016558, 0.023817, -0.043818, -0.061375, 0.067003, -0.023421, 0.103502, -0.033183, 0.001046, -0.054139, -0.008243, 0.045347, 0.019134, 0.004774, -0.074943, 0.061599, 0.08263, -0.040426, 0.010847, 0.001629, -0.042297, 0.048411, -0.016336, 0.015362, 0.025051, 0.030049, 0.005608, 0.021213, 0.017278, 0.00386, -0.00129, 0.025045, 0.038732, -0.112649, -0.068845, 0.091121, -0.008, 0.080029, -0.039866])}),
       (:Book {_id: 'B10', title: 'One Hundred Years of Solitude', author: 'Gabriel García Márquez', summary: 'Following the Buendía family across multiple generations in the fictional town of Macondo, this novel blends history, myth, and magical realism to explore themes of fate, solitude, and the cyclical nature of time.', summaryEmbedding: ai.vector([0.026657, 0.028431, -0.032534, 0.056663, -0.022202, 0.038214, -0.007063, -0.097044, -0.024331, -0.042871, -0.00251, -0.01553, 0.04323, -0.108958, -0.037939, 0.044918, -0.02538, 0.022936, 0.015863, 0.027742, 0.034097, -0.021096, 0.024324, 0.119196, -0.073228, 0.006559, 0.093397, 0.018486, -0.077086, -0.066561, -0.061422, 0.083535, -0.017346, -0.049387, -0.001638, 0.014735, 0.012934, 0.054124, -0.018105, 0.008935, -0.008215, 0.013462, 0.006916, -0.057713, -0.036141, -0.076769, -0.01255, -0.042816, 0.033945, 0.011049, 0.012599, 0.006512, -0.013986, 0.011707, 0.011394, 0.138732, -0.090052, -0.001359, 0.047595, -0.031377, 0.048807, 0.015989, -0.040635, -0.000918, 0.049152, 0.006386, 0.014818, 0.06819, -0.012148, -0.115982, 0.081899, 0.009315, -0.008733, -0.010497, 0.055025, 0.063113, -0.065804, -0.046015, -0.054258, -0.10576, -0.030416, -0.030894, 0.052531, -0.0009, -0.078448, 0.002013, 0.083189, -0.036041, 0.044023, 0.002832, 0.011774, -0.039046, 0.005307, -0.024456, -0.024371, 0.04093, 0.013415, 0.002909, 0.030738, 0.046649, -0.015398, -0.013008, 0.077159, 0.028251, 0.03245, -0.077669, -0.002729, -0.031976, -0.024357, -0.040971, 0.019992, -0.036634, -0.002091, -0.000272, 0.032189, 0.027045, -0.000631, -0.048646, -0.005171, 0.045688, 0.083919, 0.078233, -0.07958, 0.019427, 9.8e-05, 0.017786, 0.064538, -0.0, 0.011291, 0.031707, -0.065485, 0.062288, 0.066205, 0.03635, -0.068279, 0.012186, -0.066348, -0.103788, -0.000231, 0.046946, -0.059594, -0.012265, -0.005379, 0.03138, -0.093309, 0.028483, 0.129385, -0.010616, -0.036748, 0.04558, -0.108451, -0.056888, -0.075547, 0.018319, -0.002528, 0.016778, 0.002166, 0.040355, 0.062555, 0.102585, -6e-05, -0.149261, 0.010235, 0.03125, 0.011882, -0.041834, -0.002033, 0.042827, -0.057175, -0.027426, -0.110007, 0.047332, -0.000561, -0.067093, 0.073731, -0.022006, 0.016884, 0.024503, -0.078724, -0.021635, -0.0234, 0.000914, -0.027096, 0.000546, -0.006549, -0.023952, 0.066146, 0.005767, 0.162328, 0.019604, 0.048126, 0.022859, 0.066474, -0.015293, 0.006383, 0.100716, 0.058188, -0.036845, -0.026259, 0.004199, 0.040034, 0.007741, -0.006, 0.03083, 0.016829, -0.018671, -0.063338, -0.016366, -0.052646, -0.035678, -0.024429, 0.059136, 0.047461, 0.003303, 0.057969, -0.068163, -0.095383, 0.001882, 0.062801, 0.057053, 0.041009, -0.070887, -0.064489, -0.0, 0.046044, -0.058527, 0.012656, -0.020662, 0.065134, -0.078622, -0.137736, 0.058991, -0.036417, -0.025577, -0.001395, -0.053878, 0.099823, -0.000594, 0.032634, -0.033411, 0.084393, -0.023813, -0.061469, 0.007068, -0.038479, -0.041105, -0.091287, -0.116455, 0.109362, 0.032847, -0.016454, 0.000362, -0.121496, 0.070174, -0.000928, -0.009022, 0.047538, 0.005848, -0.010767, 0.059154, 0.050466, -0.022684, 0.029563, -0.074714, -0.032717, -0.059118, -0.010511, -0.060255, -0.000631, 0.090146, 0.01357, 0.05687, 0.040539, -0.024013, 0.096113, 0.030667, 0.0207, -0.046447, 0.022878, -0.048885, 0.009639, -0.055045, -0.056503, 0.057068, -0.045769, 0.032228, -0.002691, 0.011516, -0.007624, 0.007416, -0.079591, -0.053043, -0.029711, -0.01563, -0.065008, -0.046114, -0.042554, -0.004175, -0.067101, 0.114811, 0.004281, -0.009707, -0.023001, 0.027512, -0.007294, -0.036965, 0.011704, 0.00298, -0.066851, 0.009078, -0.078874, 0.004576, 0.013394, 0.029089, -0.02249, -0.052906, -0.004407, -0.044846, 0.006333, -0.0, 0.081447, -0.018687, 0.007597, -0.033239, 0.009538, 0.013418, 0.045043, -0.052031, -0.062322, 0.056952, -0.032707, -0.013834, 0.053223, 0.068142, 0.051683, 0.024035, 0.150549, -0.024804, -0.037482, -0.018459, 0.021708, 0.00225, 0.061038, -0.057281, -0.018757, 0.038778, -0.048686, -0.073497, 0.098296, 0.001349, 0.099337, 0.037205, -0.004721, 0.068433, -0.018506, -0.041574, -0.063517, 0.100771, -0.093404, -0.085058, 0.122797, -0.036402, -0.04629, -0.001159, 0.054401, -0.06072, 0.074008, 0.051591, 0.009301, 0.019513, -0.057999, -0.015122, 0.074181, 0.053202, 0.052196, -0.000656, -0.006664, 0.027594, -0.028435, -0.004762, 0.018872, 0.074735, 0.010855, -0.005242])})
Click to expand

Showing Vector Index

Retrieve all vector indexes in the current graph:

GQL
SHOW VECTOR INDEX

The result includes the following fields:

Field
Description
index_nameVector index name.
labelThe label of the indexed nodes (* if applied to all labels).
propertyThe indexed property.
dimensionsThe number of vector dimensions.
node_countNumber of vectors currently indexed.
metricThe similarity metric (cosine, euclidean, or dot).
mHNSW connectivity parameter.
ef_constructionHNSW construction parameter.
ef_searchHNSW search parameter.
quantizedWhether product quantization is enabled.
memory_bytesMemory usage of the index in bytes.
statusIndex status: READY (serving queries), BUILDING (initial bulk build in progress), REBUILDING (REBUILD VECTOR INDEX is running; queries see an empty index until done), or STALE (loaded from disk but the on-disk manifest didn't match — usually caused by a crash mid-save; the index serves no results until rebuilt).

Creating Vector Index

You can create a vector index using the CREATE VECTOR INDEX statement for a vector-type node or edge property. The index is built asynchronously — use SHOW VECTOR INDEX to check build progress.

Syntax
<create vector index statement> ::=
  "CREATE VECTOR INDEX" [ "IF NOT EXISTS" ] <index name> "ON" < "NODE" | "EDGE" >
  <label name> "(" <vector property name> ")" 
  "OPTIONS" "{" <option> { "," <option> }... "}"

Details

  • The <index name> must be unique among vector indexes.
  • Use IF NOT EXISTS to avoid errors when the index already exists.
  • <option>s for a vector index:
OptionTypeDefaultDescription
dimensionsINT/Required. The dimension of the vectors to be indexed. Vectors with a different dimension are rejected.
metricSTRINGcosineThe similarity metric. Supports cosine, euclidean, and dot.
mINT16HNSW parameter: Maximum number of connections per node. Higher values improve recall but increase memory and build time.
efConstructionINT200HNSW parameter: Size of dynamic candidate list during index construction. Higher values improve quality but increase build time.
NOTE

efSearch is not a create-time option. It is set after the index is built — see Adjusting Search Parameters.

Create a vector index named summary_embedding for the VECTOR-type property summaryEmbedding of Book nodes:

GQL
CREATE VECTOR INDEX summary_embedding ON NODE Book (summaryEmbedding) OPTIONS {
  dimensions: 384,
  metric: "cosine"
}

Automatic Sync on Mutations

After the index is created, normal data mutations on indexed nodes are reflected in the index automatically — no manual rebuild is needed for incremental writes:

You only need to run REBUILD VECTOR INDEX (or ai.rebuild_index()) after a crash recovery (when the index status is STALE), or after changing m/efConstruction.

Dimension Validation

INSERT and SET on an indexed vector property reject vectors whose length doesn't match the index's dimensions.

The mutation does not take effect — the rejection is atomic. Validation only runs against the indexed labels; non-indexed labels accept any vector length.

Dropping Vector Index

Dropping a vector index does not affect the actual property values.

GQL
DROP VECTOR INDEX summary_embedding

Use IF EXISTS to avoid errors when the index doesn't exist:

GQL
DROP VECTOR INDEX IF EXISTS summary_embedding

Using Vector Index

When a vector index exists, queries using ai.distance() or ai.cosine() with ORDER BY ... LIMIT or WHERE threshold conditions are automatically optimized to use the index for fast approximate nearest neighbor (ANN) search.

k-NN Search

Find the k nearest neighbors using ORDER BY with LIMIT. The query vector must be inlined directly in the ai.cosine() or ai.distance() call — variable references (LET, MATCH) are not supported as the query vector argument. The optimizer automatically uses the vector index.

GQL
MATCH (b:Book)
RETURN b.title, ai.cosine(b.summaryEmbedding, ai.embed('romantic novel about social class')) AS similarity
ORDER BY similarity DESC
LIMIT 3
NOTE

The query vector's dimension must match the index's dimensions setting. For example, if the index uses 384-dimensional embeddings, ai.embed() must use a provider that produces 384-dimensional vectors.

The following patterns are optimized:

  • ORDER BY ai.distance(n.prop, queryVector) ASC LIMIT k — nearest by cosine distance
  • ORDER BY ai.cosine(n.prop, queryVector) DESC LIMIT k — nearest by cosine similarity

Range Search

Find all vectors within a similarity threshold using a WHERE condition:

GQL
MATCH (b:Book)
WHERE ai.cosine(b.summaryEmbedding, ai.embed('dystopian society and surveillance')) > 0.5
RETURN b.title, ai.cosine(b.summaryEmbedding, ai.embed('dystopian society and surveillance')) AS similarity
ORDER BY similarity DESC

The following patterns are optimized:

  • WHERE ai.distance(n.prop, queryVector) < threshold — within cosine distance
  • WHERE ai.cosine(n.prop, queryVector) > threshold — above cosine similarity

Managing Vector Index

Adjusting Search Parameters

efSearch controls the size of the dynamic candidate list during search. Higher values explore more neighbors, improving recall at the cost of latency. The default is 100. It is the only runtime-mutable index option, and it is not accepted at CREATE VECTOR INDEX time — set it after the index is built using either of the two equivalent forms below.

Function-call form:

GQL
RETURN ai.set_index_option('summary_embedding', 'efSearch', 200)

Statement form:

GQL
ALTER VECTOR INDEX summary_embedding SET efSearch = 200

To change m or efConstruction, drop and recreate the index with the new options, or edit the index configuration and run ai.rebuild_index().

Rebuilding an Index

If an index is in STALE status (e.g., after a crash), rebuild it. Two equivalent forms:

Function-call form:

GQL
RETURN ai.rebuild_index('summary_embedding')

Statement form:

GQL
REBUILD VECTOR INDEX summary_embedding