From 030dc3f01da47e84bd696421857ca58765022480 Mon Sep 17 00:00:00 2001 From: swilly22 Date: Sun, 5 Nov 2023 16:56:06 +0200 Subject: [PATCH] document vector index create, query and deletion --- commands/graph.query.md | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/commands/graph.query.md b/commands/graph.query.md index 74cb1eb..75e5fb8 100644 --- a/commands/graph.query.md +++ b/commands/graph.query.md @@ -1581,3 +1581,70 @@ For a node label, the full-text index deletion syntax is: ```sh GRAPH.QUERY DEMO_GRAPH "CALL db.idx.fulltext.drop('Movie')" ``` + +## Vector indexing + +With the introduction of the vector data-type a new type of index was introduce. +A vector index is a dedicated index for indexing and retriving vectors + +To create this type of index use the following syntax: + +```sh +CREATE VECTOR INDEX FOR ON OPTIONS +``` + +For example, to create a vector index over all Product nodes description attribute +use the following syntax: + +```sh +CREATE VECTOR INDEX FOR (p:Product) ON (p.description) OPTIONS {dim:128, similarityFunction:'euclidean'} +``` + +Please note when creating a vector index both the vector dimension and simlilarity function +must be provided. At the moment the only supported simlilarity function is 'euclidean'. + +### Query vector index + +Vector indicies are used to retrived similar vectors to a given query vector +using the similarity function as a measure of "distance" + +To query the index use the vector.query procedure as follows: + +```sh +CALL db.idx.vector.query( { + type: 'NODE'/'RELATIONSHIP', + label: