Skip to content

Commit 1c3f6c5

Browse files
committed
docs(neo4j): update to reflect standalone node support (#338)
1 parent 14f6802 commit 1c3f6c5

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

docs/docs/ops/storages.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,46 @@ You can find an end-to-end example [here](https://github.com/cocoindex-io/cocoin
4848

4949
## Neo4j
5050

51-
### Setup
52-
5351
If you don't have a Postgres database, you can start a Postgres SQL database for cocoindex using our docker compose config:
5452

5553
```bash
5654
docker compose -f <(curl -L https://raw.githubusercontent.com/cocoindex-io/cocoindex/refs/heads/main/dev/neo4j.yaml) up -d
5755
```
5856

59-
### Neo4jRelationship
60-
61-
The `Neo4jRelationship` storage exports each row as a relationship to Neo4j Knowledge Graph.
62-
When you collect rows for `Neo4jRelationship`, fields will be mapped to a relationship and source/target nodes for the relationship:
57+
:::warning
6358

64-
* You can explicitly specify fields mapped to source/target nodes.
65-
* All remaining fields will be mapped to relationship properties by default.
59+
The docker compose config above will start a Neo4j Enterprise instance under the [Evaluation License](https://neo4j.com/terms/enterprise_us/),
60+
with 30 days trial period.
61+
Please read and agree the license before starting the instance.
6662

63+
:::
6764

68-
The spec takes the following fields:
65+
The `Neo4j` storage exports each row as a relationship to Neo4j Knowledge Graph. The spec takes the following fields:
6966

7067
* `connection` (type: [auth reference](../core/flow_def#auth-registry) to `Neo4jConnectionSpec`): The connection to the Neo4j database. `Neo4jConnectionSpec` has the following fields:
7168
* `uri` (type: `str`): The URI of the Neo4j database to use as the internal storage, e.g. `bolt://localhost:7687`.
7269
* `user` (type: `str`): Username for the Neo4j database.
7370
* `password` (type: `str`): Password for the Neo4j database.
7471
* `db` (type: `str`, optional): The name of the Neo4j database to use as the internal storage, e.g. `neo4j`.
75-
* `rel_type` (type: `str`): The type of the relationship.
76-
* `source`/`target` (type: `Neo4jRelationshipEndSpec`): The source/target node of the relationship, with the following fields:
77-
* `label` (type: `str`): The label of the node.
78-
* `fields` (type: `list[Neo4jFieldMapping]`): Map fields from the collector to nodes in Neo4j, with the following fields:
79-
* `field_name` (type: `str`): The name of the field in the collected row.
80-
* `node_field_name` (type: `str`, optional): The name of the field to use as the node field. If unspecified, will use the same as `field_name`.
81-
* `nodes` (type: `dict[str, Neo4jRelationshipNodeSpec]`): This configures indexes for different node labels. Key is the node label. The value `Neo4jRelationshipNodeSpec` has the following fields to configure [storage indexes](../core/flow_def#storage-indexes) for the node.
82-
* `primary_key_fields` is required.
83-
* `vector_indexes` is also supported and optional.
72+
* `mapping`: The mapping from collected row to nodes or relationships of the graph. 2 variations are supported:
73+
* `cocoindex.storages.GraphNode`: each collected row is mapped to a node in the graph. It has the following fields:
74+
* `label`: The label of the node.
75+
* `cocoindex.storages.GraphRelationship`: each collected row is mapped to a relationship in the graph,
76+
With the following fields:
77+
78+
* `rel_type` (type: `str`): The type of the relationship.
79+
* `source`/`target` (type: `cocoindex.storages.GraphRelationshipEnd`): The source/target node of the relationship, with the following fields:
80+
* `label` (type: `str`): The label of the node.
81+
* `fields` (type: `list[cocoindex.storages.GraphFieldMapping]`): Map fields from the collector to nodes in Neo4j, with the following fields:
82+
* `field_name` (type: `str`): The name of the field in the collected row.
83+
* `node_field_name` (type: `str`, optional): The name of the field to use as the node field. If unspecified, will use the same as `field_name`.
84+
85+
:::info
86+
87+
All fields specified in `fields` will be mapped to properties of source/target nodes. All remaining fields will be mapped to relationship properties by default.
88+
89+
:::
90+
91+
* `nodes` (type: `dict[str, cocoindex.storages.GraphRelationshipNode]`): This configures indexes for different node labels. Key is the node label. The value type `GraphRelationshipNode` has the following fields to configure [storage indexes](../core/flow_def#storage-indexes) for the node.
92+
* `primary_key_fields` is required.
93+
* `vector_indexes` is also supported and optional.

0 commit comments

Comments
 (0)