$npx -y skills add neo4j-contrib/neo4j-skills --skill neo4j-vector-index-skillCreate and manage Neo4j vector indexes, run vector similarity search (ANN/kNN),
| 1 | ## When to Use |
| 2 | - Creating a vector index (`CREATE VECTOR INDEX`) on nodes or relationships |
| 3 | - Running vector similarity / nearest-neighbor search |
| 4 | - Storing embeddings on graph nodes during ingestion |
| 5 | - Indexing/querying embeddings already written by GDS algorithms |
| 6 | - Choosing similarity function, dimensions, HNSW params, or quantization |
| 7 | - Using `SEARCH` clause (2026.01+) or `db.index.vector.queryNodes()` (2025.x) |
| 8 | - Batch-updating embeddings after model change |
| 9 | - Combining vector results with immediate graph neighborhood (full retrieval_query pipelines → `neo4j-graphrag-skill`) |
| 10 | - Hybrid search that combines vector results with fulltext or other ranked sources |
| 11 | |
| 12 | ## When NOT to Use |
| 13 | - **GraphRAG pipelines** (VectorCypherRetriever, HybridCypherRetriever, retrieval_query) → `neo4j-graphrag-skill` |
| 14 | - **Fulltext-only / keyword-only search** (FULLTEXT INDEX, `db.index.fulltext.queryNodes`) → `neo4j-cypher-skill` |
| 15 | - **Computing GDS graph embeddings** (FastRP, Node2Vec, GraphSAGE) → `neo4j-gds-skill` |
| 16 | - **Index admin** (list all indexes, drop range/text/lookup indexes) → `neo4j-cypher-skill` |
| 17 | |
| 18 | --- |
| 19 | |
| 20 | ## Pre-flight — Determine Version |
| 21 | |
| 22 | Drives syntax choice: |
| 23 | ```cypher |
| 24 | CALL dbms.components() YIELD versions RETURN versions[0] AS neo4j_version |
| 25 | ``` |
| 26 | |
| 27 | | Version | Use | |
| 28 | |---|---| |
| 29 | | `2026.01` or higher | `SEARCH` clause (in-index filtering, preferred) | |
| 30 | | `2025.x` | `db.index.vector.queryNodes()` procedure (**deprecated 2026.04** — use `SEARCH` when on 2026.x) | |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | ## Step 1 — Create Vector Index |
| 35 | |
| 36 | Node index (single label): |
| 37 | ```cypher |
| 38 | CYPHER 25 |
| 39 | CREATE VECTOR INDEX chunk_embedding IF NOT EXISTS |
| 40 | FOR (c:Chunk) ON (c.embedding) |
| 41 | OPTIONS { |
| 42 | indexConfig: { |
| 43 | `vector.dimensions`: 1536, |
| 44 | `vector.similarity_function`: 'cosine', |
| 45 | `vector.quantization.type`: 'SCALAR', |
| 46 | `vector.hnsw.m`: 16, |
| 47 | `vector.hnsw.ef_construction`: 100 |
| 48 | } |
| 49 | } |
| 50 | ``` |
| 51 | |
| 52 | Node index **with filterable properties** [2026.01+] — `WITH` declares which properties can be used in `SEARCH ... WHERE`: |
| 53 | ```cypher |
| 54 | CYPHER 25 |
| 55 | CREATE VECTOR INDEX chunk_embedding IF NOT EXISTS |
| 56 | FOR (c:Chunk) ON (c.embedding) |
| 57 | WITH [c.source, c.lang, c.published_year] // stored as metadata; filterable in SEARCH WHERE |
| 58 | OPTIONS { indexConfig: { `vector.dimensions`: 1536, `vector.similarity_function`: 'cosine' } } |
| 59 | ``` |
| 60 | |
| 61 | Multi-label index with filterable properties [2026.01+]: |
| 62 | ```cypher |
| 63 | CYPHER 25 |
| 64 | CREATE VECTOR INDEX doc_embedding IF NOT EXISTS |
| 65 | FOR (n:Document|Article) ON n.embedding |
| 66 | WITH [n.author, n.published_year, n.lang] |
| 67 | OPTIONS { indexConfig: { `vector.dimensions`: 1536, `vector.similarity_function`: 'cosine' } } |
| 68 | ``` |
| 69 | |
| 70 | Relationship index: |
| 71 | ```cypher |
| 72 | CYPHER 25 |
| 73 | CREATE VECTOR INDEX rel_embedding IF NOT EXISTS |
| 74 | FOR ()-[r:HAS_CHUNK]-() ON (r.embedding) |
| 75 | OPTIONS { indexConfig: { `vector.dimensions`: 768, `vector.similarity_function`: 'cosine' } } |
| 76 | ``` |
| 77 | |
| 78 | **`WITH` property types** — only scalar types allowed: `INTEGER`, `FLOAT`, `STRING`, `BOOLEAN`, `DATE`, `ZONED DATETIME`, `LOCAL DATETIME`, `ZONED TIME`, `LOCAL TIME`, `DURATION`. Not allowed: `LIST`, `POINT`, or the vector property itself. |
| 79 | |
| 80 | **Index config reference:** |
| 81 | |
| 82 | | Parameter | Type | Default | Notes | |
| 83 | |---|---|---|---| |
| 84 | | `vector.dimensions` | INTEGER 1–4096 | none | Required; must match embedding model exactly | |
| 85 | | `vector.similarity_function` | STRING | `'cosine'` | `'cosine'` or `'euclidean'` | |
| 86 | | `vector.quantization.type` | STRING | `'SCALAR'` | `NONE`, `SCALAR`, or `BINARY` [2026.06+]; reduces storage; BINARY smallest, most aggressive; needs vector-2.0+ (5.18+) | |
| 87 | | `vector.quantization.enabled` | BOOLEAN | `true` | **Deprecated 2026.06** — use `vector.quantization.type` | |
| 88 | | `vector.default_search_expansion_factor` | FLOAT | `1.0` NONE / `1.5` SCALAR / `2.0` BINARY | [2026.06+]; value >1.0 on quantized vectors enables automatic rescoring with full-precision vectors; not settable at query time | |
| 89 | | `vector.hnsw.m` | INTEGER 1–512 | `16` | HNSW graph connections; higher = better recall, more memory | |
| 90 | | `vector.hnsw.ef_co |