In this challenge, you will apply your knowledge and create the vector index on the Answer
nodes.
The Answer
nodes have a text
and embeddings
property. The text
property contains the answer text, and the embeddings
property is the vector representation of the answer text.
Your task is to create a vector index on the Answer
nodes using the embedding
property.
You should note the following:
-
The index should be named
answers
. -
The embedding has 1536 dimensions.
-
The vector index should use the
cosine
similarity function.
Here is the Cypher you used to create the questions
index:
CREATE VECTOR INDEX questions IF NOT EXISTS
FOR (q:Question)
ON q.embedding
OPTIONS {indexConfig: {
`vector.dimensions`: 1536,
`vector.similarity_function`: 'cosine'
}}
You can view the current vector indexes by running the following Cypher:
SHOW INDEXES WHERE type = "VECTOR"
Validate Results
Once you have created the index, click the Check Database button to verify that the task is complete.
Hint
Modify the CREATE INDEX
Cypher statement to create a vector index named answers
for the Answer
nodes.
You can view the existing indexes in the database by running the following Cypher statement:
SHOW INDEXES
Solution
Run this Cypher statement to create the the vector index:
CREATE VECTOR INDEX answers IF NOT EXISTS
FOR (a:Answer)
ON a.embedding
OPTIONS {indexConfig: {
`vector.dimensions`: 1536,
`vector.similarity_function`: 'cosine'
}}
Lesson Summary
In this challenge, you used Cypher to create a vector index.
In the next lesson, you will learn how to query vector indexes.