[フレーム]
Docs
Neo4j DBMS
Neo4j Aura
Neo4j Tools
Neo4j Graph Data Science
Cypher Query Language
Generative AI
Create applications
Connect data sources
Labs
GenAI Ecosystem
Developer Tools
Frameworks & Integrations
RDF & Linked Data
Get Help
Community Forum
Discord Chat
Product Support
Neo4j Developer Blog
Neo4j Videos
GraphAcademy
Beginners Courses
Data Scientist Courses
Generative AI Courses
Neo4j Certification
Get Started Free
Search
Skip to content
Raise an issue

Create vector index

Vector indexes allow Neo4j to run similarity queries across the whole database. The example below shows how to create a vector index for movie embeddings, under the name of moviePlots.

CREATE VECTOR INDEX moviePlots
FOR (m:Movie)
ON m.embedding
OPTIONS {indexConfig: {
 `vector.dimensions`: 384, (1)
 `vector.similarity_function`: 'cosine' (2)
}}
1 For embeddings generated with the SentenceTransformers model all-MiniLM-L6-v2. A different model may require a different dimension.
2 The cosine similarity function is the most common choice. For more details and other options, see Vector indexes → Cosine and Euclidean similarity functions.
CREATE VECTOR INDEX moviePlots
FOR (m:Movie)
ON m.embedding
OPTIONS {indexConfig: {
 `vector.dimensions`: 1536, (1)
 `vector.similarity_function`: 'cosine' (2)
}}
1 For embeddings generated with the OpenAI model text-embedding-ada-002. A different model may require a different dimension.
2 The cosine similarity function is the most common choice. For more details and other options, see Vector indexes → Cosine and Euclidean similarity functions.

For more information on vector indexes, see Cypher® → Indexes → Vector indexes.

AltStyle によって変換されたページ (->オリジナル) /