Create the Answer Vector Index

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:

  1. The index should be named answers.

  2. The embedding has 1536 dimensions.

  3. The vector index should use the cosine similarity function.

Here is the Cypher you used to create the questions index:

cypher
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:

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:

cypher
SHOW INDEXES

Solution

Run this Cypher statement to create the the vector index:

cypher
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.